diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index 49e3905..52eda3e 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -265,7 +265,7 @@ namespace RJW_Menstruation } } // Scenario B: Pregnant, grow in the second half of first trimester - else if (parent.pawn.IsPregnant()) + else if (parent.pawn.IsRJWPregnant()) { float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, parent.pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement; if (breastSizeIncreased > pregnancySize) @@ -301,7 +301,7 @@ namespace RJW_Menstruation float newNippleProgress; if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks) newNippleProgress = 1f; - else if (parent.pawn.IsPregnant()) + else if (parent.pawn.IsRJWPregnant()) newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress()); else newNippleProgress = 0f; diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs index 2c8c2c9..4c89ac0 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs @@ -51,7 +51,7 @@ namespace RJW_Menstruation "eggs: " + comp.GetNumofEggs + "\n"; } else description += comp.GetCurStageLabel + "\n"; - if (pawn.IsPregnant()) + if (pawn.IsRJWPregnant()) { Hediff_BasePregnancy hediff = comp.Pregnancy; if (hediff != null && Utility.ShowFetusImage(hediff)) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index cb4274e..6b83677 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -135,12 +135,14 @@ namespace RJW_Menstruation else return false; } + public static bool IsRJWPregnant(this Pawn pawn) + { + return pawn.health.hediffSet.GetHediffs().Any(); + } public static float GetFarthestPregnancyProgress(this Pawn pawn) { - IEnumerable pregnancies = pawn.health.hediffSet.GetHediffs(); - if (!pregnancies.Any()) return 0; - else return pregnancies.MaxBy(hediff => hediff.GestationProgress)?.GestationProgress ?? 0; + return pawn.health.hediffSet.GetHediffs().MaxByWithFallback(hediff => hediff.GestationProgress)?.GestationProgress ?? 0; } public static float GetPregnancyProgress(this HediffComp_Menstruation comp)