Slight change to how ageOfLastBirth works, cut down on the save file size for breasts

This commit is contained in:
lutepickle 2023-05-03 08:04:36 -07:00
parent 6344a7c7ad
commit 0999063728
2 changed files with 11 additions and 14 deletions

Binary file not shown.

View file

@ -75,9 +75,6 @@ namespace RJW_Menstruation
if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human
if (RJWPregnancySettings.phantasy_pregnancy)
babyHalfAge /= GenDate.DaysPerYear;
return babyHalfAge; return babyHalfAge;
} }
} }
@ -140,10 +137,10 @@ namespace RJW_Menstruation
{ {
base.CompExposeData(); base.CompExposeData();
Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true); Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", -1);
Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true); Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true);
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true); Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", 0.0f);
Scribe_Values.Look(ref nippleProgress, "nippleProgress", nippleProgress, true); Scribe_Values.Look(ref nippleProgress, "nippleProgress", 0.0f);
Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true); Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true);
Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true); Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true);
Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true); Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
@ -199,19 +196,19 @@ 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 = -1;
if ((Pawn.relations == null)) return youngestAge; if ((Pawn.relations == null)) return youngestAge;
List<Hediff_BasePregnancy> pregnancies = new List<Hediff_BasePregnancy>(); List<Hediff_BasePregnancy> rjwPregnancies = new List<Hediff_BasePregnancy>();
Pawn.health.hediffSet.GetHediffs(ref pregnancies); Pawn.health.hediffSet.GetHediffs(ref rjwPregnancies);
bool hasChild = Pawn.relations.Children. bool hasChild = Pawn.relations.Children.
Where(child => !pregnancies.Any(preg => preg.babies.Contains(child))). // no fetuses Where(child => !rjwPregnancies.Any(preg => preg.babies.Contains(child))). // no fetuses
Where(child => child.GetMother() == Pawn). // not Dad Where(child => child.GetMother() == Pawn). // not Dad
TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest);
if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks; if (hasChild) youngestAge = Math.Max(Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks, -1);
return youngestAge; return youngestAge;
} }
@ -224,7 +221,7 @@ namespace RJW_Menstruation
{ {
maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f); maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f);
} }
if (ageOfLastBirth == 0) if (ageOfLastBirth == 0 || ageOfLastBirth < -1)
{ {
ageOfLastBirth = CalculateLastBirth(); ageOfLastBirth = CalculateLastBirth();
} }
@ -253,7 +250,7 @@ namespace RJW_Menstruation
debugGrowthStatus = "Base size (ageless)"; debugGrowthStatus = "Base size (ageless)";
} }
// The youngest child is less than halfway into babyhood: Full size // The youngest child is less than halfway into babyhood: Full size
else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
{ {
debugGrowthStatus = "Full size due to young child"; debugGrowthStatus = "Full size due to young child";
if (breastSizeIncreased < MaxBreastIncrement) if (breastSizeIncreased < MaxBreastIncrement)
@ -299,7 +296,7 @@ namespace RJW_Menstruation
float newNippleProgress; float newNippleProgress;
if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f) if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f)
newNippleProgress = 0f; newNippleProgress = 0f;
else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
newNippleProgress = 1f; newNippleProgress = 1f;
else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant()) else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress()); newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());