Merge breastadjuster branch
2
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
#.pdn
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
@ -341,3 +342,4 @@ healthchecksdb
|
||||||
|
|
||||||
*.psd
|
*.psd
|
||||||
*.dds
|
*.dds
|
||||||
|
*.pdn
|
||||||
|
|
|
@ -87,6 +87,17 @@
|
||||||
</value>
|
</value>
|
||||||
</Operation>
|
</Operation>
|
||||||
|
|
||||||
|
<Operation Class="PatchOperationAdd">
|
||||||
|
<xpath>Defs/rjw.HediffDef_PartBase[defName="UdderBreasts"]</xpath>
|
||||||
|
<value>
|
||||||
|
<comps>
|
||||||
|
<li Class="RJW_Menstruation.CompProperties_Breast">
|
||||||
|
<BreastTex>Breasts_Udder/Breast</BreastTex>
|
||||||
|
<BlacknippleColor>(55,20,0)</BlacknippleColor>
|
||||||
|
</li>
|
||||||
|
</comps>
|
||||||
|
</value>
|
||||||
|
</Operation>
|
||||||
|
|
||||||
|
|
||||||
</Patch>
|
</Patch>
|
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Areola00.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Areola01.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Areola02.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Areola03.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Areola04.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Nipple00.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Nipple01.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Nipple02.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast00_Nipple03.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Areola00.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Areola01.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Areola02.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Areola03.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Areola04.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Nipple00.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Nipple01.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Nipple02.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast01_Nipple03.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Areola00.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Areola01.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Areola02.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Areola03.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Areola04.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Nipple00.png
Normal file
After Width: | Height: | Size: 612 B |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Nipple01.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Nipple02.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast02_Nipple03.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Areola00.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Areola01.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Areola02.png
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Areola03.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Areola04.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Nipple00.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Nipple01.png
Normal file
After Width: | Height: | Size: 338 B |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Nipple02.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast03_Nipple03.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Areola00.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Areola01.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Areola02.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Areola03.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Areola04.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Nipple00.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Nipple01.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Nipple02.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast04_Nipple03.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05.png
Normal file
After Width: | Height: | Size: 997 B |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Areola00.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Areola01.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Areola02.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Areola03.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Areola04.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Nipple00.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Nipple01.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Nipple02.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
1.3/Textures/Breasts_Udder/Breast_Breast05_Nipple03.png
Normal file
After Width: | Height: | Size: 3 KiB |
|
@ -52,7 +52,9 @@ namespace RJW_Menstruation
|
||||||
protected float nippleSizePermanent = -1f;
|
protected float nippleSizePermanent = -1f;
|
||||||
protected float nippleSizeCurrent = -1f;
|
protected float nippleSizeCurrent = -1f;
|
||||||
protected float nippleSize = -1f;
|
protected float nippleSize = -1f;
|
||||||
|
protected long ageOfLastBirth = 0;
|
||||||
protected float breastSizeIncreased = 0f;
|
protected float breastSizeIncreased = 0f;
|
||||||
|
protected string debugGrowthStatus = "(Growth/shrink not yet calculated; run for 1.5h to update)";
|
||||||
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 +63,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 / 2;
|
||||||
|
if (res == default)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
@ -137,6 +164,7 @@ namespace RJW_Menstruation
|
||||||
Scribe_Values.Look(ref nippleSizePermanent, "nippleSizePermanent", DEFAULTNIPPLE, true);
|
Scribe_Values.Look(ref nippleSizePermanent, "nippleSizePermanent", DEFAULTNIPPLE, true);
|
||||||
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 ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true);
|
||||||
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
|
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, 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);
|
||||||
|
@ -150,6 +178,7 @@ namespace RJW_Menstruation
|
||||||
public override void CompPostPostAdd(DamageInfo? dinfo)
|
public override void CompPostPostAdd(DamageInfo? dinfo)
|
||||||
{
|
{
|
||||||
if (!loaded) Initialize();
|
if (!loaded) Initialize();
|
||||||
|
if (ageOfLastBirth > parent.pawn.ageTracker.AgeChronologicalTicks) ageOfLastBirth = CalculateLastBirth(); // catch transplant issues
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CompPostPostRemoved()
|
public override void CompPostPostRemoved()
|
||||||
|
@ -167,10 +196,41 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected long CalculateLastBirth()
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
isFetus = preg.babies.Contains(child);
|
||||||
|
}
|
||||||
|
else isFetus = false;
|
||||||
|
if (
|
||||||
|
parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth &&
|
||||||
|
!isFetus &&
|
||||||
|
child.GetMother() == parent.pawn // Don't do Dad's boobs
|
||||||
|
)
|
||||||
|
youngestAge = parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return youngestAge;
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
Props = (CompProperties_Breast)props;
|
Props = (CompProperties_Breast)props;
|
||||||
action = Transition;
|
action = Transition;
|
||||||
|
|
||||||
|
if (ageOfLastBirth == 0)
|
||||||
|
{
|
||||||
|
ageOfLastBirth = CalculateLastBirth();
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -206,23 +266,47 @@ 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)
|
|
||||||
|
// Scenario A: the youngest child is less than halfway into babyhood: Full size
|
||||||
|
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks)
|
||||||
{
|
{
|
||||||
|
debugGrowthStatus = "Full size due to young child";
|
||||||
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||||
{
|
{
|
||||||
breastSizeIncreased += 0.02f;
|
parent.Severity += (MAX_BREAST_INCREMENT - breastSizeIncreased);
|
||||||
parent.Severity += 0.02f;
|
breastSizeIncreased = MAX_BREAST_INCREMENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
// Scenario B: Pregnant, grow in the second half of first trimester
|
||||||
|
else if (parent.pawn.IsPregnant())
|
||||||
{
|
{
|
||||||
if (breastSizeIncreased > 0)
|
float pregnancySize = Mathf.InverseLerp(1f / 6f, 1f / 3f, parent.pawn.GetPregnancyProgress()) * MAX_BREAST_INCREMENT;
|
||||||
|
if (breastSizeIncreased > pregnancySize)
|
||||||
{
|
{
|
||||||
breastSizeIncreased -= 0.02f;
|
debugGrowthStatus = "Shrinking due to being oversize for pregnancy";
|
||||||
parent.Severity -= 0.02f;
|
// Breasts still large from the last kid
|
||||||
|
ShrinkBreasts();
|
||||||
}
|
}
|
||||||
|
else if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||||
|
{
|
||||||
|
// Time to grow
|
||||||
|
float growAmount = pregnancySize - breastSizeIncreased;
|
||||||
|
if (growAmount != 0)
|
||||||
|
debugGrowthStatus = "Growing due to pregnancy";
|
||||||
|
else
|
||||||
|
debugGrowthStatus = "Pregnant, but not time to grow";
|
||||||
|
breastSizeIncreased += growAmount;
|
||||||
|
parent.Severity += growAmount;
|
||||||
|
}
|
||||||
|
else debugGrowthStatus = "Pregnant and full size";
|
||||||
}
|
}
|
||||||
|
// Scenario C: Not (or very early) pregnant and youngest child nonexistent or more than halfway into babyhood, time to shrink
|
||||||
|
else if (breastSizeIncreased > 0)
|
||||||
|
{
|
||||||
|
debugGrowthStatus = "Shrinking due to no pregnancy nor young child";
|
||||||
|
ShrinkBreasts();
|
||||||
|
}
|
||||||
|
else debugGrowthStatus = "Base size";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeColorFermanant(float alpha)
|
public void ChangeColorFermanant(float alpha)
|
||||||
|
@ -252,6 +336,7 @@ namespace RJW_Menstruation
|
||||||
areolaSize = areolaSizePermanent;
|
areolaSize = areolaSizePermanent;
|
||||||
nippleSize = nippleSizePermanent;
|
nippleSize = nippleSizePermanent;
|
||||||
pregnant = false;
|
pregnant = false;
|
||||||
|
ageOfLastBirth = parent.pawn.ageTracker.AgeBiologicalTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,7 +390,9 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
public string DebugInfo()
|
public string DebugInfo()
|
||||||
{
|
{
|
||||||
return "Alpha: " + alpha +
|
return "Increase: " + breastSizeIncreased +
|
||||||
|
"\n" + debugGrowthStatus +
|
||||||
|
"\nAlpha: " + alpha +
|
||||||
"\nNippleSize: " + nippleSize +
|
"\nNippleSize: " + nippleSize +
|
||||||
"\nAreolaSize: " + areolaSize +
|
"\nAreolaSize: " + areolaSize +
|
||||||
"\nAlphaCurrent: " + alphaCurrent +
|
"\nAlphaCurrent: " + alphaCurrent +
|
||||||
|
|