mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Compare commits
2 commits
1d6dc1fc82
...
96109e7607
Author | SHA1 | Date | |
---|---|---|---|
|
96109e7607 | ||
|
034bf4d75a |
3 changed files with 16 additions and 19 deletions
Binary file not shown.
|
@ -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<Hediff_BasePregnancy>().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<Hediff_BasePregnancy>().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);
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue