Don't let a biotech pregnancy go into labor if another womb already is

This commit is contained in:
lutepickle 2022-11-04 07:08:59 -07:00
parent 2846117881
commit 8c213c4fe6
2 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using HarmonyLib;
using System.Linq;
using RimWorld;
using Verse;
@ -47,4 +48,17 @@ namespace RJW_Menstruation
comp.Pregnancy = null;
}
}
// Prevents a pregnancy from going into labor if another pregnancy already is
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.GestationProgress), MethodType.Getter)]
public class Hediff_Pregnant_GestationProgess_Patch
{
public static void PostFix(Hediff_Pregnant __instance, ref float __result)
{
if (__result < 1f) return;
Pawn pawn = __instance.pawn;
if (pawn.health.hediffSet.hediffs.Any(hediff => hediff.def == HediffDefOf.PregnancyLabor || hediff.def == HediffDefOf.PregnancyLaborPushing))
__result = 0.999f;
}
}
}

View File

@ -1,6 +1,7 @@
Version 1.0.8.1
- Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.
- Properly track biotech pregnancy through labor.
- A biotech pregnancy will pause before going into labor if another womb already is in labor.
Version 1.0.8.0
- Support for RimWorld 1.4. All future changes to Menstruation will only be for Rimworld 1.4.