mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Make the breast adjustment go off of the mother's biological age
This commit is contained in:
parent
e0b8f30e76
commit
89d6353e16
2 changed files with 60 additions and 54 deletions
Binary file not shown.
|
@ -52,8 +52,8 @@ namespace RJW_Menstruation
|
|||
protected float nippleSizePermanent = -1f;
|
||||
protected float nippleSizeCurrent = -1f;
|
||||
protected float nippleSize = -1f;
|
||||
protected long ageOfLastBirth = 0;
|
||||
protected float breastSizeIncreased = 0f;
|
||||
protected long lastBabyBorn = -1;
|
||||
protected float originalpha = -1f;
|
||||
protected float originareola = -1f;
|
||||
protected float originnipple = -1f;
|
||||
|
@ -66,7 +66,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
get
|
||||
{
|
||||
float res = (parent?.pawn?.RaceProps?.lifeStageAges?.ElementAtOrDefault(1).minAge ?? 0.0f) / 2;
|
||||
float res = parent.pawn.RaceProps.lifeStageAges.ElementAtOrDefault(1).minAge / 2;
|
||||
if (res == 0.0f)
|
||||
{
|
||||
if (Configurations.Debug) Log.Warning($"Could not find end age of baby lifestage for {parent.pawn}'s race");
|
||||
|
@ -163,6 +163,7 @@ namespace RJW_Menstruation
|
|||
Scribe_Values.Look(ref nippleSizePermanent, "nippleSizePermanent", DEFAULTNIPPLE, true);
|
||||
Scribe_Values.Look(ref nippleSizeCurrent, "nippleSizeCurrent", DEFAULTNIPPLE, true);
|
||||
Scribe_Values.Look(ref nippleSize, "nippleSize", DEFAULTNIPPLE, true);
|
||||
Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true);
|
||||
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
|
||||
Scribe_Values.Look(ref originalpha, "originalpha", originalpha, true);
|
||||
Scribe_Values.Look(ref originareola, "originareola", originareola, true);
|
||||
|
@ -176,6 +177,7 @@ namespace RJW_Menstruation
|
|||
public override void CompPostPostAdd(DamageInfo? dinfo)
|
||||
{
|
||||
if (!loaded) Initialize();
|
||||
if (ageOfLastBirth > parent.pawn.ageTracker.AgeChronologicalTicks) ageOfLastBirth = CalculateLastBirth(); // catch transplant issues
|
||||
}
|
||||
|
||||
public override void CompPostPostRemoved()
|
||||
|
@ -193,17 +195,14 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
protected long CalculateLastBirth()
|
||||
{
|
||||
Props = (CompProperties_Breast)props;
|
||||
action = Transition;
|
||||
|
||||
if (lastBabyBorn < 0)
|
||||
{
|
||||
if ((parent?.pawn?.relations?.ChildrenCount ?? 0) > 0)
|
||||
long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either
|
||||
if ((parent.pawn.relations?.ChildrenCount ?? 0) > 0)
|
||||
{
|
||||
foreach (Pawn child in parent.pawn.relations.Children)
|
||||
{
|
||||
|
||||
bool isFetus;
|
||||
if (PregnancyHelper.GetPregnancy(parent.pawn) is Hediff_BasePregnancy preg)
|
||||
{
|
||||
|
@ -211,14 +210,24 @@ namespace RJW_Menstruation
|
|||
}
|
||||
else isFetus = false;
|
||||
if (
|
||||
child.ageTracker.BirthAbsTicks > lastBabyBorn &&
|
||||
parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth &&
|
||||
!isFetus &&
|
||||
child.GetMother() == parent.pawn // Don't do Dad's boobs
|
||||
)
|
||||
lastBabyBorn = child.ageTracker.BirthAbsTicks;
|
||||
youngestAge = parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks;
|
||||
}
|
||||
}
|
||||
else lastBabyBorn = 0;
|
||||
return youngestAge;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Props = (CompProperties_Breast)props;
|
||||
action = Transition;
|
||||
|
||||
if (ageOfLastBirth == 0)
|
||||
{
|
||||
ageOfLastBirth = CalculateLastBirth();
|
||||
}
|
||||
|
||||
if (alphaPermanent < 0f)
|
||||
|
@ -257,10 +266,8 @@ namespace RJW_Menstruation
|
|||
UpdateColor();
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
|
||||
|
||||
if (!(parent?.pawn?.health?.Dead ?? true))
|
||||
{
|
||||
// Scenario A: the youngest child is less than halfway into babyhood: Full size
|
||||
if (lastBabyBorn + BabyHalfAge * GenDate.TicksPerYear > GenTicks.TicksAbs)
|
||||
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks)
|
||||
{
|
||||
if (Configurations.Debug) Log.Message($"Latest child of {parent.pawn} is young: breasts to full size");
|
||||
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||
|
@ -295,7 +302,6 @@ namespace RJW_Menstruation
|
|||
ShrinkBreasts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeColorFermanant(float alpha)
|
||||
{
|
||||
|
@ -324,7 +330,7 @@ namespace RJW_Menstruation
|
|||
areolaSize = areolaSizePermanent;
|
||||
nippleSize = nippleSizePermanent;
|
||||
pregnant = false;
|
||||
lastBabyBorn = GenTicks.TicksAbs;
|
||||
ageOfLastBirth = parent.pawn.ageTracker.AgeBiologicalTicks;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue