diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index 82593ee..7395d1b 100644 Binary files a/1.3/Assemblies/RJW_Menstruation.dll and b/1.3/Assemblies/RJW_Menstruation.dll differ 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 57d6e5a..e7eaf60 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 @@ -210,25 +210,16 @@ namespace RJW_Menstruation protected long CalculateLastBirth() { long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either - if ((Pawn.relations?.ChildrenCount ?? 0) > 0) - { - foreach (Pawn child in Pawn.relations.Children) - { - bool isFetus = false; - if (Pawn.health.hediffSet.GetHediffs().Any(preg => preg.babies.Contains(child))) - { - isFetus = true; - break; - } - - if ( - Pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth && - !isFetus && - child.GetMother() == Pawn // Don't do Dad's boobs - ) - youngestAge = Pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks; - } - } + + if ((Pawn.relations == null)) return youngestAge; + + bool hasChild = Pawn.relations.Children. + Where(child => !Pawn.health.hediffSet.GetHediffs().Any(preg => preg.babies.Contains(child))). // no fetuses + Where(child => child.GetMother() == Pawn). // not Dad + TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); + + if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks; + return youngestAge; } @@ -337,6 +328,11 @@ namespace RJW_Menstruation } } + public void GaveBirth() + { + ageOfLastBirth = Pawn.ageTracker.AgeBiologicalTicks; + } + public void AdjustNippleProgress(float amount) { nippleProgress = Mathf.Clamp01(nippleProgress + amount); diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index 8c91cb6..0f4123c 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -72,6 +72,7 @@ namespace RJW_Menstruation pawn.health.RemoveHediff(this); HediffComp_Menstruation comp = this.GetMenstruationComp(); if(comp != null) comp.Pregnancy = null; + pawn.GetBreastComp()?.GaveBirth(); } public string GetBabyInfo()