Compare commits

..

No commits in common. "96109e7607bdb58c1bd24440daac3436fff03bc9" and "1d6dc1fc82a7f55571114785839c5fc67dc8fa9c" have entirely different histories.

3 changed files with 19 additions and 16 deletions

Binary file not shown.

View file

@ -210,16 +210,25 @@ namespace RJW_Menstruation
protected long CalculateLastBirth() protected long CalculateLastBirth()
{ {
long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either
if ((Pawn.relations?.ChildrenCount ?? 0) > 0)
if ((Pawn.relations == null)) return youngestAge; {
foreach (Pawn child in Pawn.relations.Children)
bool hasChild = Pawn.relations.Children. {
Where(child => !Pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any(preg => preg.babies.Contains(child))). // no fetuses bool isFetus = false;
Where(child => child.GetMother() == Pawn). // not Dad if (Pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any(preg => preg.babies.Contains(child)))
TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); {
isFetus = true;
if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks; 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;
}
}
return youngestAge; return youngestAge;
} }
@ -328,11 +337,6 @@ namespace RJW_Menstruation
} }
} }
public void GaveBirth()
{
ageOfLastBirth = Pawn.ageTracker.AgeBiologicalTicks;
}
public void AdjustNippleProgress(float amount) public void AdjustNippleProgress(float amount)
{ {
nippleProgress = Mathf.Clamp01(nippleProgress + amount); nippleProgress = Mathf.Clamp01(nippleProgress + amount);

View file

@ -72,7 +72,6 @@ namespace RJW_Menstruation
pawn.health.RemoveHediff(this); pawn.health.RemoveHediff(this);
HediffComp_Menstruation comp = this.GetMenstruationComp(); HediffComp_Menstruation comp = this.GetMenstruationComp();
if(comp != null) comp.Pregnancy = null; if(comp != null) comp.Pregnancy = null;
pawn.GetBreastComp()?.GaveBirth();
} }
public string GetBabyInfo() public string GetBabyInfo()