mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
In the context of menstruation, CanImpregnate is called to see if the cum being added is fertile. In RJW, already being pregnant is enough to block a new one, but in menstruation it's fine if fertile cum enters a pregnant womb, or if cum goes into a different womb than the pregnant one. So never have a pawn with a womb be considered pregnant for those checks.
The other times that CanImpregnate is called is for the fetish, but that's already checked against DangerDay. Also add some more null checks for the transpilers.
This commit is contained in:
parent
05029858d5
commit
08c6c28c81
2 changed files with 25 additions and 0 deletions
Binary file not shown.
|
@ -122,6 +122,28 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(PregnancyHelper), nameof(PregnancyHelper.CanImpregnate))]
|
||||||
|
public static class CanImpregnate_Patch
|
||||||
|
{
|
||||||
|
private static bool PregnancyBlocksImpregnation(this Pawn pawn, bool _)
|
||||||
|
{
|
||||||
|
if (!Configurations.EnableAnimalCycle && pawn.IsAnimal()) return pawn.IsPregnant();
|
||||||
|
else if (pawn.GetMenstruationComps().Any()) return false;
|
||||||
|
else return pawn.IsPregnant();
|
||||||
|
}
|
||||||
|
private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
|
||||||
|
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||||
|
{
|
||||||
|
if (IsPregnant == null) throw new System.InvalidOperationException("IsPregnant not found");
|
||||||
|
foreach(CodeInstruction instruction in instructions)
|
||||||
|
{
|
||||||
|
if (instruction.Calls(IsPregnant))
|
||||||
|
yield return CodeInstruction.Call(typeof(CanImpregnate_Patch), nameof(PregnancyBlocksImpregnation));
|
||||||
|
else yield return instruction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(Hediff_BasePregnancy), nameof(Hediff_BasePregnancy.PostBirth))]
|
[HarmonyPatch(typeof(Hediff_BasePregnancy), nameof(Hediff_BasePregnancy.PostBirth))]
|
||||||
public static class RJW_Patch_PostBirth
|
public static class RJW_Patch_PostBirth
|
||||||
{
|
{
|
||||||
|
@ -216,6 +238,7 @@ namespace RJW_Menstruation
|
||||||
private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
|
private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
|
||||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||||
{
|
{
|
||||||
|
if (MinimumFuckabilityToHookup == null) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
|
||||||
bool first_fuckability = true;
|
bool first_fuckability = true;
|
||||||
foreach (CodeInstruction instruction in instructions)
|
foreach (CodeInstruction instruction in instructions)
|
||||||
{
|
{
|
||||||
|
@ -251,6 +274,8 @@ namespace RJW_Menstruation
|
||||||
private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
|
private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
|
||||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||||
{
|
{
|
||||||
|
if (MinimumAttractivenessToHookup == null) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
|
||||||
|
if (MinimumRelationshipToHookup == null) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
|
||||||
LocalBuilder pawn_index = null;
|
LocalBuilder pawn_index = null;
|
||||||
// Like in the last one, we switch the arguments around for the second load
|
// Like in the last one, we switch the arguments around for the second load
|
||||||
bool first_attractiveness = true;
|
bool first_attractiveness = true;
|
||||||
|
|
Loading…
Reference in a new issue