mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Initial implementation of redone breast grow/shrink
This commit is contained in:
parent
47492f6472
commit
e6fdeb837e
2 changed files with 87 additions and 13 deletions
Binary file not shown.
|
@ -53,6 +53,7 @@ namespace RJW_Menstruation
|
||||||
protected float nippleSizeCurrent = -1f;
|
protected float nippleSizeCurrent = -1f;
|
||||||
protected float nippleSize = -1f;
|
protected float nippleSize = -1f;
|
||||||
protected float breastSizeIncreased = 0f;
|
protected float breastSizeIncreased = 0f;
|
||||||
|
protected long lastBabyBorn = -1;
|
||||||
protected float originalpha = -1f;
|
protected float originalpha = -1f;
|
||||||
protected float originareola = -1f;
|
protected float originareola = -1f;
|
||||||
protected float originnipple = -1f;
|
protected float originnipple = -1f;
|
||||||
|
@ -61,6 +62,31 @@ namespace RJW_Menstruation
|
||||||
protected bool pregnant = false;
|
protected bool pregnant = false;
|
||||||
public Action action;
|
public Action action;
|
||||||
|
|
||||||
|
protected float BabyHalfAge
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float res = (parent?.pawn?.RaceProps?.lifeStageAges?.ElementAtOrDefault(1).minAge ?? 0.0f) / 2;
|
||||||
|
if (res == 0.0f)
|
||||||
|
{
|
||||||
|
if (Configurations.Debug) Log.Warning($"Could not find end age of baby lifestage for {parent.pawn}'s race");
|
||||||
|
res = 1.2f / 2; // Default to human
|
||||||
|
}
|
||||||
|
if (RJWPregnancySettings.phantasy_pregnancy)
|
||||||
|
res /= GenDate.DaysPerYear;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ShrinkBreasts()
|
||||||
|
{
|
||||||
|
// The natural rate will take them from full to empty during the second half of their child's babyhood
|
||||||
|
float shrinkRate = TICKINTERVAL * MAX_BREAST_INCREMENT / (BabyHalfAge * GenDate.TicksPerYear);
|
||||||
|
float shrinkAmount = Mathf.Min(shrinkRate, breastSizeIncreased);
|
||||||
|
breastSizeIncreased -= shrinkAmount;
|
||||||
|
parent.Severity -= shrinkAmount;
|
||||||
|
}
|
||||||
|
|
||||||
public float MaxAlpha
|
public float MaxAlpha
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -132,6 +158,7 @@ namespace RJW_Menstruation
|
||||||
Scribe_Values.Look(ref nippleSizeCurrent, "nippleSizeCurrent", DEFAULTNIPPLE, true);
|
Scribe_Values.Look(ref nippleSizeCurrent, "nippleSizeCurrent", DEFAULTNIPPLE, true);
|
||||||
Scribe_Values.Look(ref nippleSize, "nippleSize", DEFAULTNIPPLE, true);
|
Scribe_Values.Look(ref nippleSize, "nippleSize", DEFAULTNIPPLE, true);
|
||||||
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
|
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
|
||||||
|
Scribe_Values.Look(ref lastBabyBorn, "lastBabyBorn", lastBabyBorn, true);
|
||||||
Scribe_Values.Look(ref originalpha, "originalpha", originalpha, true);
|
Scribe_Values.Look(ref originalpha, "originalpha", originalpha, true);
|
||||||
Scribe_Values.Look(ref originareola, "originareola", originareola, true);
|
Scribe_Values.Look(ref originareola, "originareola", originareola, true);
|
||||||
Scribe_Values.Look(ref originnipple, "originnipple", originnipple, true);
|
Scribe_Values.Look(ref originnipple, "originnipple", originnipple, true);
|
||||||
|
@ -165,6 +192,30 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
Props = (CompProperties_Breast)props;
|
Props = (CompProperties_Breast)props;
|
||||||
action = Transition;
|
action = Transition;
|
||||||
|
|
||||||
|
if (lastBabyBorn < 0)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
isFetus = preg.babies.Contains(child);
|
||||||
|
}
|
||||||
|
else isFetus = false;
|
||||||
|
if (
|
||||||
|
child.ageTracker.BirthAbsTicks > lastBabyBorn &&
|
||||||
|
!isFetus &&
|
||||||
|
child.GetMother() == parent.pawn // Don't do Dad's boobs
|
||||||
|
)
|
||||||
|
lastBabyBorn = child.ageTracker.BirthAbsTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else lastBabyBorn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (alphaPermanent < 0f)
|
if (alphaPermanent < 0f)
|
||||||
{
|
{
|
||||||
alphaPermanent = (Utility.RandGaussianLike(0.0f, 0.3f) + Rand.Range(0.0f,0.5f))/2;
|
alphaPermanent = (Utility.RandGaussianLike(0.0f, 0.3f) + Rand.Range(0.0f,0.5f))/2;
|
||||||
|
@ -200,23 +251,45 @@ namespace RJW_Menstruation
|
||||||
nippleSizeCurrent = Mathf.Lerp(nippleSizeCurrent, nippleSize, Configurations.NippleTransitionRatio);
|
nippleSizeCurrent = Mathf.Lerp(nippleSizeCurrent, nippleSize, Configurations.NippleTransitionRatio);
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
|
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
|
||||||
if (pregnant)
|
|
||||||
|
if (!(parent?.pawn?.health?.Dead ?? true))
|
||||||
{
|
{
|
||||||
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
// Scenario A: the youngest child is less than halfway into babyhood: Full size
|
||||||
|
if (lastBabyBorn + BabyHalfAge * GenDate.TicksPerYear > GenTicks.TicksAbs)
|
||||||
{
|
{
|
||||||
breastSizeIncreased += 0.02f;
|
if (Configurations.Debug) Log.Message($"Latest child of {parent.pawn} is young: breasts to full size");
|
||||||
parent.Severity += 0.02f;
|
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||||
|
{
|
||||||
|
parent.Severity += (MAX_BREAST_INCREMENT - breastSizeIncreased);
|
||||||
|
breastSizeIncreased = MAX_BREAST_INCREMENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Scenario B: Pregnant, grow in the second half of first trimester
|
||||||
|
else if (parent.pawn.IsPregnant())
|
||||||
|
{
|
||||||
|
float pregnancySize = Mathf.Lerp(1 / 6, 1 / 3, parent.pawn.GetPregnancyProgress()) * MAX_BREAST_INCREMENT;
|
||||||
|
if (breastSizeIncreased > pregnancySize)
|
||||||
|
{
|
||||||
|
if (Configurations.Debug) Log.Message($"{parent.pawn}'s breasts are too large for pregnancy ({breastSizeIncreased} > {pregnancySize}), shrinking");
|
||||||
|
// Breasts still large from the last kid
|
||||||
|
ShrinkBreasts();
|
||||||
|
}
|
||||||
|
else if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||||
|
{
|
||||||
|
// Time to grow
|
||||||
|
float growAmount = pregnancySize - breastSizeIncreased;
|
||||||
|
if (Configurations.Debug) Log.Message($"{parent.pawn} is pregnant, so growing breasts by {growAmount}");
|
||||||
|
breastSizeIncreased += growAmount;
|
||||||
|
parent.Severity += growAmount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Scenario C: Not (or very early) pregnant and youngest child nonexistent or more than halfway into babyhood, time to shrink
|
||||||
|
else if (breastSizeIncreased > 0)
|
||||||
|
{
|
||||||
|
if (Configurations.Debug) Log.Message($"{parent.pawn}'s breasts are too large and she is not pregnant, shrinking");
|
||||||
|
ShrinkBreasts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (breastSizeIncreased > 0)
|
|
||||||
{
|
|
||||||
breastSizeIncreased -= 0.02f;
|
|
||||||
parent.Severity -= 0.02f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeColorFermanant(float alpha)
|
public void ChangeColorFermanant(float alpha)
|
||||||
|
@ -246,6 +319,7 @@ namespace RJW_Menstruation
|
||||||
areolaSize = areolaSizePermanent;
|
areolaSize = areolaSizePermanent;
|
||||||
nippleSize = nippleSizePermanent;
|
nippleSize = nippleSizePermanent;
|
||||||
pregnant = false;
|
pregnant = false;
|
||||||
|
lastBabyBorn = GenTicks.TicksAbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue