mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Refactor breast CalculateLastBirth
This commit is contained in:
parent
034bf4d75a
commit
96109e7607
1 changed files with 10 additions and 19 deletions
|
@ -210,25 +210,16 @@ 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.
|
||||||
bool isFetus = false;
|
Where(child => !Pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any(preg => preg.babies.Contains(child))). // no fetuses
|
||||||
if (Pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any(preg => preg.babies.Contains(child)))
|
Where(child => child.GetMother() == Pawn). // not Dad
|
||||||
{
|
TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest);
|
||||||
isFetus = true;
|
|
||||||
break;
|
if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks;
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue