From 6fe38eb46e3496245e528254183cca718d5a8ae9 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Fri, 4 Nov 2022 12:06:03 -0700 Subject: [PATCH] Respect Biotech IUDs --- .../HediffComps/HediffComp_InducedOvulator.cs | 2 +- .../HediffComps/HediffComp_Menstruation.cs | 6 +++--- .../RJW_Menstruation/HediffComps/MenstruationUtility.cs | 7 +++++++ changelogs.txt | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs index a1ab09a..55b7ecf 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs @@ -67,7 +67,7 @@ namespace RJW_Menstruation { get { - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.HasIUD()) return false; switch (curStage) { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index d2b9c86..88cb3f8 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -472,7 +472,7 @@ namespace RJW_Menstruation { get { - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.HasIUD()) return false; switch (curStage) { @@ -739,7 +739,7 @@ namespace RJW_Menstruation public void CumIn(Pawn pawn, float volume, float fertility = 1.0f, ThingDef filthdef = null) { if (volume <= 0) return; - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) fertility /= 100f; + if (Pawn.HasIUD()) fertility /= 100f; float cumd = TotalCumPercent; float tmp = TotalCum + volume; if (tmp > CumCapacity) @@ -852,7 +852,7 @@ namespace RJW_Menstruation Hediff asa = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA); float asafactor = asa?.Severity ?? 0f; - if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) antisperm = 0.70f + asafactor; + if (Pawn.HasIUD()) antisperm = 0.70f + asafactor; else antisperm = 0.0f + asafactor; absorber = (Absorber)Pawn.apparel?.WornApparel?.Find(x => x is Absorber); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index a243f52..5e5679c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -357,5 +357,12 @@ namespace RJW_Menstruation return res; } + + public static bool HasIUD(this Pawn pawn) + { + if (pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return true; + if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true; + return false; + } } } diff --git a/changelogs.txt b/changelogs.txt index bd3a237..425353e 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -3,6 +3,7 @@ Version 1.0.8.1 - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes. - Properly track biotech pregnancy through labor. - Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle. + - Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack. - A biotech pregnancy will pause before going into labor if another womb already is in labor. Version 1.0.8.0