From ff039e3065489fc177d7b62a728e933f9ed49f0f Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Mon, 25 Jul 2022 11:45:18 -0700 Subject: [PATCH] Have get_Pregnancy test to see if the pawn has the hediff. Won't happen for MultiplePregnancy, but the base pregnancy and the nonstandard ones will. Mostly useful for the window between a pregnancy ending and the last PregnantAction firing. --- .../HediffComps/HediffComp_Menstruation.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index c8cd38a..a4e75af 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -121,7 +121,19 @@ namespace RJW_Menstruation protected float? originvagsize = null; protected Hediff_BasePregnancy pregnancy = null; - public Hediff_BasePregnancy Pregnancy { get => pregnancy; set => pregnancy = value; } + public Hediff_BasePregnancy Pregnancy { + get + { + if (pregnancy == null) return null; + else if (!parent.pawn.health.hediffSet.hediffs.Contains(pregnancy)) + { + pregnancy = null; + return null; + } + else return pregnancy; + } + set => pregnancy = value; + } public int OvaryPowerThreshold {