Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Source/Client/Factions/MultifactionPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> inst
yield return ci;
}
}
static bool IsFreeColonistAnyPlayerFaction(Pawn pawn)
public static bool IsFreeColonistAnyPlayerFaction(Pawn pawn)
{
if (Multiplayer.Client == null || !Multiplayer.GameComp.multifaction)
return pawn.IsFreeColonist;
Expand Down Expand Up @@ -818,3 +818,23 @@ static void Finalizer(Gravship gravship, Map map,bool __state)
map.PopFaction();
}
}

[HarmonyPatch(typeof(QuestPart_LendColonistsToFaction), "Enable")]
static class QuestPart_LendColonistsToFaction_Enable_Patch
{
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> insts)
{
var isFreeColonist = AccessTools.PropertyGetter(typeof(Pawn), nameof(Pawn.IsFreeColonist));
var replacement = AccessTools.Method(typeof(CompShuttle_ContainedColonistCount_Patch),
nameof(CompShuttle_ContainedColonistCount_Patch.IsFreeColonistAnyPlayerFaction));
foreach (var ci in insts)
{
if (ci.Calls(isFreeColonist))
{
ci.opcode = OpCodes.Call;
ci.operand = replacement;
}
yield return ci;
}
}
}
Loading