Fixed #1: Submissive gender can't be marked for comfort

This commit is contained in:
amevarashi 2022-10-28 22:49:15 +05:00
parent 36f879e0b6
commit d483924c47
2 changed files with 24 additions and 4 deletions

View File

@ -94,7 +94,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.3524</Version>
<Version>1.4.3530</Version>
</PackageReference>
<PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version>

View File

@ -156,10 +156,11 @@ namespace RJWSexperience.Ideology.Patches
}
}
[HarmonyPatch(typeof(PawnDesignations_Comfort), nameof(PawnDesignations_Comfort.UpdateCanDesignateComfort))]
public static class RJW_PatchUpdateCanDesignateComfort
[HarmonyPatch(typeof(PawnDesignations_Comfort))]
public static class RJW_Patch_PawnDesignations_Comfort_Submissive
{
public static void Postfix(Pawn pawn, ref bool __result)
[HarmonyPostfix, HarmonyPatch(nameof(PawnDesignations_Comfort.UpdateCanDesignateComfort))]
public static void UpdateCanDesignateComfort(Pawn pawn, ref bool __result)
{
if (pawn.IsSubmissive())
{
@ -167,6 +168,25 @@ namespace RJWSexperience.Ideology.Patches
__result = true;
}
}
/// <summary>
/// RJW undesignates if it thinks that the pawn can't be a comfort pawn.
/// Why the hell checker method changes the state?
/// </summary>
/// <param name="pawn">Pawn to check</param>
/// <param name="__result">Is pawn currenlty designated as comfort</param>
/// <returns>Run the original method</returns>
[HarmonyPrefix, HarmonyPatch(nameof(PawnDesignations_Comfort.IsDesignatedComfort))]
public static bool IsDesignatedComfort(Pawn pawn, ref bool __result)
{
if (pawn.IsSubmissive() && !pawn.Dead)
{
__result = pawn.GetRJWPawnData().Comfort;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Hediff_BasePregnancy), nameof(Hediff_BasePregnancy.PostBirth))]