mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Rewrite nipple system to a simpler version
This commit is contained in:
parent
df1455ece2
commit
105c4df01f
12 changed files with 196 additions and 284 deletions
Binary file not shown.
|
@ -94,14 +94,12 @@
|
|||
<Option23_Label>Dominant hybrid extension</Option23_Label>
|
||||
<Option23_Label_1>Mother</Option23_Label_1>
|
||||
<Option23_Label_2>Father</Option23_Label_2>
|
||||
<Option24_Label>Transition variance of nipples after pregnancy</Option24_Label>
|
||||
<Option24_Desc>Set how much nipples/areolas should darken/widen on every pregnancy.</Option24_Desc>
|
||||
<Option25_Label>Permanent transition variance of nipples</Option25_Label>
|
||||
<Option25_Desc>Set how much nipples/areolas should darken/widen permanently on every pregnancy.</Option25_Desc>
|
||||
<Option26_Label>Maximum transition</Option26_Label>
|
||||
<Option26_Desc>Nipples/areolas won't be darker/wider than this value.</Option26_Desc>
|
||||
<Option27_Label>Transition speed of nipples</Option27_Label>
|
||||
<Option27_Desc>Set speed of transition of nipples/areolas. 1 = instant transition</Option27_Desc>
|
||||
<Option_MaxBreastIncrementFactor_Label>Breast growth during pregnancy</Option_MaxBreastIncrementFactor_Label>
|
||||
<Option_MaxBreastIncrementFactor_Desc>Change how much a pregnant pawn's breasts will grow when pregnant. Some pawns will grow more than others.</Option_MaxBreastIncrementFactor_Desc>
|
||||
<Option_MaxNippleIncrementFactor_Label>Nipple change during pregnancy</Option_MaxNippleIncrementFactor_Label>
|
||||
<Option_MaxNippleIncrementFactor_Desc>Change how much a pregnant pawn's nipples will change during pregnancy.</Option_MaxNippleIncrementFactor_Desc>
|
||||
<Option_PermanentNippleChange_Label>Permanent nipple change after pregnancy</Option_PermanentNippleChange_Label>
|
||||
<Option_PermanentNippleChange_Desc>Adjusts approximately how much of a pregnant pawn's nipples will remain changed after the pregnancy ends.</Option_PermanentNippleChange_Desc>
|
||||
<Option28_Label>Customize Hybrids</Option28_Label>
|
||||
<Option28_Tooltip>Open custom hybrid editor. This will overrides hybrid definitions of XML files.</Option28_Tooltip>
|
||||
<Option29_Label>Allow shrink icon</Option29_Label>
|
||||
|
|
Binary file not shown.
|
@ -32,8 +32,7 @@ namespace MilkModule
|
|||
{
|
||||
if (breastcomp != null)
|
||||
{
|
||||
breastcomp.AdjustAreolaSize(Rand.Range(0.0f, 0.0001f * Configurations.NipplePermanentTransitionVariance));
|
||||
breastcomp.AdjustNippleSize(Rand.Range(0.0f, 0.0001f * Configurations.NipplePermanentTransitionVariance));
|
||||
breastcomp.AdjustNippleProgress(Rand.Range(0.0f, 0.01f));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ namespace MilkModule
|
|||
if (__instance.parent is Pawn pawn) comp = pawn.GetBreastComp();
|
||||
if (comp != null)
|
||||
{
|
||||
comp.AdjustAreolaSize(Rand.Range(0.0f, 0.01f * Configurations.NipplePermanentTransitionVariance));
|
||||
comp.AdjustNippleSize(Rand.Range(0.0f, 0.01f * Configurations.NipplePermanentTransitionVariance));
|
||||
comp.AdjustNippleProgress(Rand.Range(0.0f, 0.01f));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,9 @@ namespace RJW_Menstruation
|
|||
public const int EnzygoticTwinsChanceAdjustDefault = 2;
|
||||
public const int MaxEnzygoticTwinsDefault = 9;
|
||||
public const int BleedingAmountDefault = 50;
|
||||
public const float NippleTransitionVarianceDefault = 0.2f;
|
||||
public const float NipplePermanentTransitionVarianceDefault = 0.02f;
|
||||
public const float NippleMaximumTransitionDefault = 0.4f;
|
||||
public const float NippleTransitionSpeedDefault = 0.035f;
|
||||
public const float MaxBreastIncrementFactorDefault = 1.0f;
|
||||
public const float MaxNippleIncrementFactorDefault = 1.0f;
|
||||
public const float PermanentNippleChangeDefault = 0.1f;
|
||||
public const float EggLifespanMultiplierDefault = 1.0f;
|
||||
public const float VaginaMorphPowerDefault = 0.2f;
|
||||
|
||||
|
@ -67,19 +66,9 @@ namespace RJW_Menstruation
|
|||
public static float EggLifespanMultiplier = EggLifespanMultiplierDefault;
|
||||
public static bool EnableBirthVaginaMorph = false;
|
||||
public static float VaginaMorphPower = VaginaMorphPowerDefault;
|
||||
|
||||
public static float NippleTransitionVariance = NippleTransitionVarianceDefault;
|
||||
public static float NipplePermanentTransitionVariance = NipplePermanentTransitionVarianceDefault;
|
||||
public static float NippleMaximumTransition = NippleMaximumTransitionDefault;
|
||||
public static float NippleTransitionSpeed = NippleTransitionSpeedDefault;
|
||||
public static float NippleTransitionRatio
|
||||
{
|
||||
get
|
||||
{
|
||||
return NippleTransitionVariance * NippleTransitionSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
public static float MaxBreastIncrementFactor = MaxBreastIncrementFactorDefault;
|
||||
public static float MaxNippleIncrementFactor = MaxNippleIncrementFactorDefault;
|
||||
public static float PermanentNippleChange = PermanentNippleChangeDefault;
|
||||
public static void SettoDefault()
|
||||
{
|
||||
ImplantationChanceAdjust = ImplantationChanceAdjustDefault;
|
||||
|
@ -101,10 +90,9 @@ namespace RJW_Menstruation
|
|||
MaxEnzygoticTwins = MaxEnzygoticTwinsDefault;
|
||||
BleedingAmount = BleedingAmountDefault;
|
||||
MotherFirst = false;
|
||||
NippleTransitionVariance = NippleTransitionVarianceDefault;
|
||||
NipplePermanentTransitionVariance = NipplePermanentTransitionVarianceDefault;
|
||||
NippleMaximumTransition = NippleMaximumTransitionDefault;
|
||||
NippleTransitionSpeed = NippleTransitionSpeedDefault;
|
||||
MaxBreastIncrementFactor = MaxBreastIncrementFactorDefault;
|
||||
MaxNippleIncrementFactor= MaxNippleIncrementFactorDefault;
|
||||
PermanentNippleChange = PermanentNippleChangeDefault;
|
||||
EggLifespanMultiplier = EggLifespanMultiplierDefault;
|
||||
VaginaMorphPower = VaginaMorphPowerDefault;
|
||||
}
|
||||
|
@ -214,10 +202,9 @@ namespace RJW_Menstruation
|
|||
Scribe_Values.Look(ref ShowFlag, "ShowFlag", ShowFlag, true);
|
||||
Scribe_Values.Look(ref UseHybridExtention, "UseHybridExtention", UseHybridExtention, true);
|
||||
Scribe_Values.Look(ref MotherFirst, "MotherFirst", MotherFirst, true);
|
||||
Scribe_Values.Look(ref NippleTransitionVariance, "NippleTransitionVariance", NippleTransitionVariance, true);
|
||||
Scribe_Values.Look(ref NipplePermanentTransitionVariance, "NipplePermanentTransitionVariance", NipplePermanentTransitionVariance, true);
|
||||
Scribe_Values.Look(ref NippleMaximumTransition, "NippleMaximumTransition", NippleMaximumTransition, true);
|
||||
Scribe_Values.Look(ref NippleTransitionSpeed, "NippleTransitionSpeed", NippleTransitionSpeed, true);
|
||||
Scribe_Values.Look(ref MaxBreastIncrementFactor, "MaxBreastIncrementFactor", MaxBreastIncrementFactor, true);
|
||||
Scribe_Values.Look(ref MaxNippleIncrementFactor, "MaxNippleImcrementFactor", MaxNippleIncrementFactor, true);
|
||||
Scribe_Values.Look(ref PermanentNippleChange, "PermanentNippleChange", PermanentNippleChange, true);
|
||||
Scribe_Values.Look(ref AllowShrinkIcon, "AllowShrinkIcon", AllowShrinkIcon, true);
|
||||
Scribe_Values.Look(ref EggLifespanMultiplier, "EggLifespanMultiplier", EggLifespanMultiplier, true);
|
||||
Scribe_Values.Look(ref EnableBirthVaginaMorph, "EnableBirthVaginaMorph", EnableBirthVaginaMorph, true);
|
||||
|
@ -352,25 +339,20 @@ namespace RJW_Menstruation
|
|||
Configurations.ShowFlag ^= Configurations.PawnFlags.Hostile;
|
||||
}
|
||||
|
||||
Adjust = (int)(Configurations.NippleTransitionVariance * 1000);
|
||||
wombsection.Label(Translations.Option24_Label + " " + Configurations.NippleTransitionVariance * 100 + " / 100", -1, Translations.Option24_Desc);
|
||||
Adjust = (int)(Configurations.MaxBreastIncrementFactor * 1000);
|
||||
wombsection.Label(Translations.Option_MaxBreastIncrementFactor_Label + " " + Configurations.MaxBreastIncrementFactor * 100 + "%", -1, Translations.Option_MaxBreastIncrementFactor_Desc);
|
||||
Adjust = (int)wombsection.Slider(Adjust, 0, 1000);
|
||||
Configurations.NippleTransitionVariance = (float)Adjust / 1000;
|
||||
Configurations.MaxBreastIncrementFactor = (float)Adjust / 100;
|
||||
|
||||
Adjust = (int)(Configurations.NipplePermanentTransitionVariance * 1000);
|
||||
wombsection.Label(Translations.Option25_Label + " " + Configurations.NipplePermanentTransitionVariance * 100 + " / 100", -1, Translations.Option25_Desc);
|
||||
Adjust = (int)(Configurations.MaxNippleIncrementFactor * 1000);
|
||||
wombsection.Label(Translations.Option_MaxNippleIncrementFactor_Label + " " + Configurations.MaxNippleIncrementFactor * 100 + "%", -1, Translations.Option_MaxNippleIncrementFactor_Desc);
|
||||
Adjust = (int)wombsection.Slider(Adjust, 0, 1000);
|
||||
Configurations.NipplePermanentTransitionVariance = (float)Adjust / 1000;
|
||||
Configurations.MaxNippleIncrementFactor = (float)Adjust / 100;
|
||||
|
||||
Adjust = (int)(Configurations.NippleMaximumTransition * 1000);
|
||||
wombsection.Label(Translations.Option26_Label + " " + Configurations.NippleMaximumTransition * 100 + " / 100", -1, Translations.Option26_Desc);
|
||||
Adjust = (int)(Configurations.PermanentNippleChange * 1000);
|
||||
wombsection.Label(Translations.Option_PermanentNippleChange_Label + " " + Configurations.PermanentNippleChange, -1, Translations.Option_PermanentNippleChange_Desc);
|
||||
Adjust = (int)wombsection.Slider(Adjust, 0, 1000);
|
||||
Configurations.NippleMaximumTransition = (float)Adjust / 1000;
|
||||
|
||||
Adjust = (int)(Configurations.NippleTransitionSpeed * 1000);
|
||||
wombsection.Label(Translations.Option27_Label + " " + Configurations.NippleTransitionSpeed, -1, Translations.Option27_Desc);
|
||||
Adjust = (int)wombsection.Slider(Adjust, 0, 1000);
|
||||
Configurations.NippleTransitionSpeed = (float)Adjust / 1000;
|
||||
Configurations.PermanentNippleChange = (float)Adjust / 2500;
|
||||
|
||||
listmain.EndSection(wombsection);
|
||||
}
|
||||
|
|
|
@ -31,117 +31,101 @@ namespace RJW_Menstruation
|
|||
|
||||
public class HediffComp_Breast : HediffComp
|
||||
{
|
||||
public const float DEFAULTALPHA = -1;
|
||||
public const float DEFAULTAREOLA = -1;
|
||||
public const float DEFAULTNIPPLE = -1;
|
||||
public const float VARIANT = 0.2f;
|
||||
public const int TICKINTERVAL = 3750;
|
||||
public const float MAX_BREAST_INCREMENT = 0.10f;
|
||||
public const float BREAST_GROWTH_START = 1f / 6f;
|
||||
public const float BREAST_GROWTH_END = 1f / 3f;
|
||||
public const int tickInterval = GenDate.TicksPerHour * 3 / 2;
|
||||
public const float breastGrowthStart = 1f / 6f;
|
||||
public const float breastGrowthEnd = 1f / 3f;
|
||||
public static readonly SimpleCurve nippleTransitions = new SimpleCurve()
|
||||
{
|
||||
new CurvePoint(0f,0f),
|
||||
new CurvePoint(0.1f,0f),
|
||||
new CurvePoint(0.333f,0.167f),
|
||||
new CurvePoint(0.667f,0.833f),
|
||||
new CurvePoint(1.0f,1.0f)
|
||||
};
|
||||
public const float nippleChange = 0.2f;
|
||||
|
||||
public CompProperties_Breast Props;
|
||||
|
||||
protected float alphaPermanent = -1;
|
||||
protected float alphaCurrent = -1;
|
||||
protected float alpha = -1;
|
||||
protected float areolaSizePermanent = -1f;
|
||||
protected float areolaSizeCurrent = -1f;
|
||||
protected float areolaSize = -1f;
|
||||
protected float nippleSizePermanent = -1f;
|
||||
protected float nippleSizeCurrent = -1f;
|
||||
protected float nippleSize = -1f;
|
||||
protected long ageOfLastBirth = 0;
|
||||
protected float maxBreastIncrement = -1f;
|
||||
protected float maxAreolaIncrement = -1f;
|
||||
protected float breastSizeIncreased = 0f;
|
||||
protected string debugGrowthStatus = "(Growth/shrink not yet calculated; run for 1.5h to update)";
|
||||
protected float originalpha = -1f;
|
||||
protected float originareola = -1f;
|
||||
protected float originnipple = -1f;
|
||||
protected Color cachedcolor;
|
||||
protected float nippleProgress = 0f;
|
||||
protected float baseAlpha = -1f; // Will grow in response to pregnancy
|
||||
protected float baseAreola = -1f;
|
||||
protected float baseNipple = -1f;
|
||||
protected float cachedAlpha = -1f; // Calculated dynamically instead of saved
|
||||
protected float cachedAreola = -1f; // Actual size = these * breast size
|
||||
protected float cachedNipple = -1f;
|
||||
protected float babyHalfAge = -1f;
|
||||
|
||||
protected Color cachedColor;
|
||||
protected bool loaded = false;
|
||||
protected bool pregnant = false;
|
||||
|
||||
public Action action;
|
||||
|
||||
protected float BabyHalfAge
|
||||
{
|
||||
get
|
||||
{
|
||||
float res = 0;
|
||||
List<LifeStageAge> ages = parent.pawn.RaceProps.lifeStageAges;
|
||||
if (babyHalfAge >= 0f) return babyHalfAge;
|
||||
List<LifeStageAge> ages = parent.pawn.def.race.lifeStageAges;
|
||||
if (ages?.Count > 1)
|
||||
res = ages[1].minAge / 2;
|
||||
babyHalfAge = ages[1].minAge / 2;
|
||||
|
||||
if (res <= 0) res = 1.2f / 2; // Default to human
|
||||
if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human
|
||||
|
||||
if (RJWPregnancySettings.phantasy_pregnancy)
|
||||
res /= GenDate.DaysPerYear;
|
||||
babyHalfAge /= GenDate.DaysPerYear;
|
||||
|
||||
return res;
|
||||
return babyHalfAge;
|
||||
}
|
||||
}
|
||||
|
||||
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 shrinkRate = tickInterval * MaxBreastIncrement / (BabyHalfAge * GenDate.TicksPerYear);
|
||||
float shrinkAmount = Mathf.Min(shrinkRate, breastSizeIncreased);
|
||||
breastSizeIncreased -= shrinkAmount;
|
||||
parent.Severity -= shrinkAmount;
|
||||
}
|
||||
|
||||
public float MaxAlpha
|
||||
protected float MaxBreastIncrement
|
||||
{
|
||||
get
|
||||
{
|
||||
return originalpha + Configurations.NippleMaximumTransition;
|
||||
return maxBreastIncrement * Configurations.MaxBreastIncrementFactor;
|
||||
}
|
||||
}
|
||||
public float MaxAreola
|
||||
{
|
||||
get
|
||||
{
|
||||
return originareola + Configurations.NippleMaximumTransition;
|
||||
}
|
||||
}
|
||||
public float MaxNipple
|
||||
{
|
||||
get
|
||||
{
|
||||
return originnipple + Configurations.NippleMaximumTransition;
|
||||
}
|
||||
}
|
||||
|
||||
public float OriginAlpha => originalpha;
|
||||
public float OriginNipple => originnipple;
|
||||
public float OriginAreola => originareola;
|
||||
public Color OriginColor => Colors.CMYKLerp(parent?.pawn?.story?.SkinColor ?? Color.white, Props.BlackNippleColor, originalpha);
|
||||
|
||||
public Color NippleColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return cachedcolor;
|
||||
return cachedColor;
|
||||
}
|
||||
}
|
||||
public float Alpha
|
||||
{
|
||||
get
|
||||
{
|
||||
return alphaCurrent;
|
||||
return cachedAlpha;
|
||||
}
|
||||
}
|
||||
public float NippleSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return nippleSizeCurrent;
|
||||
return cachedNipple * parent.Severity;
|
||||
}
|
||||
}
|
||||
public float AreolaSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return areolaSizeCurrent;
|
||||
return cachedAreola * parent.Severity;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,22 +140,25 @@ namespace RJW_Menstruation
|
|||
public override void CompExposeData()
|
||||
{
|
||||
base.CompExposeData();
|
||||
Scribe_Values.Look(ref alphaPermanent, "alphaPermanent", DEFAULTALPHA, true);
|
||||
Scribe_Values.Look(ref alphaCurrent, "alphaCurrent", DEFAULTALPHA, true);
|
||||
Scribe_Values.Look(ref alpha, "alpha", DEFAULTALPHA, true);
|
||||
Scribe_Values.Look(ref areolaSizePermanent, "areolaSizePermanent", DEFAULTAREOLA, true);
|
||||
Scribe_Values.Look(ref areolaSizeCurrent, "areolaSizeCurrent", DEFAULTAREOLA, true);
|
||||
Scribe_Values.Look(ref areolaSize, "areolaSize", DEFAULTAREOLA, true);
|
||||
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);
|
||||
Scribe_Values.Look(ref originnipple, "originnipple", originnipple, true);
|
||||
Scribe_Values.Look(ref pregnant, "pregnant", pregnant, true);
|
||||
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.LoadingVars)
|
||||
{ // For compatibility
|
||||
Scribe_Values.Look(ref baseAlpha, "alphaPermanent", -1, false);
|
||||
Scribe_Values.Look(ref baseAreola, "areolaSizePermanent", -1, false);
|
||||
Scribe_Values.Look(ref baseNipple, "nippleSizePermanent", -1, false);
|
||||
baseAlpha *= 2;
|
||||
baseAreola *= 2;
|
||||
baseNipple *= 2;
|
||||
}
|
||||
Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true);
|
||||
Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true);
|
||||
Scribe_Values.Look(ref maxAreolaIncrement, "maxAreolaIncrement", maxAreolaIncrement, true);
|
||||
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
|
||||
Scribe_Values.Look(ref nippleProgress, "nippleProgress", nippleProgress, true);
|
||||
Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true);
|
||||
Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true);
|
||||
Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
|
||||
}
|
||||
|
||||
public override void CompPostTick(ref float severityAdjustment) { }
|
||||
|
@ -225,70 +212,69 @@ namespace RJW_Menstruation
|
|||
public void Initialize()
|
||||
{
|
||||
Props = (CompProperties_Breast)props;
|
||||
action = Transition;
|
||||
action = Update;
|
||||
|
||||
if (maxBreastIncrement <= 0f)
|
||||
{
|
||||
maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f);
|
||||
}
|
||||
if (maxAreolaIncrement <= 0f)
|
||||
{
|
||||
maxAreolaIncrement = Utility.RandGaussianLike(0.0375f, 0.1125f);
|
||||
}
|
||||
if (ageOfLastBirth == 0)
|
||||
{
|
||||
ageOfLastBirth = CalculateLastBirth();
|
||||
}
|
||||
|
||||
if (alphaPermanent < 0f)
|
||||
if (baseAlpha <= 0f)
|
||||
{
|
||||
alphaPermanent = (Utility.RandGaussianLike(0.0f, 0.3f) + Rand.Range(0.0f, 0.5f)) / 2;
|
||||
originalpha = alphaPermanent;
|
||||
alpha = alphaPermanent;
|
||||
alphaCurrent = alphaPermanent;
|
||||
baseAlpha = Utility.RandGaussianLike(0.0f, 0.3f) + Rand.Range(0.0f, 0.5f);
|
||||
}
|
||||
if (areolaSizePermanent < 0f)
|
||||
if (baseAreola <= 0f)
|
||||
{
|
||||
areolaSizePermanent = Utility.RandGaussianLike(0f, parent.Severity);
|
||||
originareola = areolaSizePermanent;
|
||||
areolaSize = areolaSizePermanent;
|
||||
areolaSizeCurrent = areolaSizePermanent;
|
||||
baseAreola = Utility.RandGaussianLike(0.0f, 1.0f);
|
||||
}
|
||||
if (nippleSizePermanent < 0f)
|
||||
if (baseNipple <= 0f)
|
||||
{
|
||||
nippleSizePermanent = Utility.RandGaussianLike(0f, parent.Severity);
|
||||
originnipple = nippleSizePermanent;
|
||||
nippleSize = nippleSizePermanent;
|
||||
nippleSizeCurrent = nippleSizePermanent;
|
||||
baseNipple = Utility.RandGaussianLike(0.0f, 1.0f);
|
||||
}
|
||||
UpdateColor();
|
||||
CalculateNipples();
|
||||
UpdateNipples();
|
||||
loaded = true;
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, GetNextUpdate(), parent.pawn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Transition()
|
||||
public void Update()
|
||||
{
|
||||
alphaCurrent = Mathf.Lerp(alphaCurrent, alpha, Configurations.NippleTransitionRatio);
|
||||
areolaSizeCurrent = Mathf.Lerp(areolaSizeCurrent, areolaSize, Configurations.NippleTransitionRatio);
|
||||
nippleSizeCurrent = Mathf.Lerp(nippleSizeCurrent, nippleSize, Configurations.NippleTransitionRatio);
|
||||
UpdateColor();
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, TICKINTERVAL, parent.pawn);
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(action, GetNextUpdate(), parent.pawn);
|
||||
CalculateBreastSize();
|
||||
CalculateNipples();
|
||||
UpdateNipples();
|
||||
}
|
||||
|
||||
protected void CalculateBreastSize()
|
||||
{
|
||||
// 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 < MaxBreastIncrement)
|
||||
{
|
||||
parent.Severity += (MAX_BREAST_INCREMENT - breastSizeIncreased);
|
||||
breastSizeIncreased = MAX_BREAST_INCREMENT;
|
||||
parent.Severity += (MaxBreastIncrement - breastSizeIncreased);
|
||||
breastSizeIncreased = MaxBreastIncrement;
|
||||
}
|
||||
}
|
||||
// Scenario B: Pregnant, grow in the second half of first trimester
|
||||
else if (parent.pawn.IsPregnant())
|
||||
{
|
||||
float pregnancySize = Mathf.InverseLerp(BREAST_GROWTH_START, BREAST_GROWTH_END, parent.pawn.GetFarthestPregnancyProgress()) * MAX_BREAST_INCREMENT;
|
||||
float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, parent.pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
|
||||
if (breastSizeIncreased > pregnancySize)
|
||||
{
|
||||
debugGrowthStatus = "Shrinking due to being oversize for pregnancy";
|
||||
// Breasts still large from the last kid
|
||||
ShrinkBreasts();
|
||||
}
|
||||
else if (breastSizeIncreased < MAX_BREAST_INCREMENT)
|
||||
else if (breastSizeIncreased < MaxBreastIncrement)
|
||||
{
|
||||
// Time to grow
|
||||
float growAmount = pregnancySize - breastSizeIncreased;
|
||||
|
@ -310,123 +296,95 @@ namespace RJW_Menstruation
|
|||
else debugGrowthStatus = "Base size";
|
||||
}
|
||||
|
||||
public void ChangeColorFermanant(float alpha)
|
||||
protected void CalculateNipples()
|
||||
{
|
||||
alphaPermanent = alpha;
|
||||
float newNippleProgress;
|
||||
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks)
|
||||
newNippleProgress = 1f;
|
||||
else if (parent.pawn.IsPregnant())
|
||||
newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress());
|
||||
else
|
||||
newNippleProgress = 0f;
|
||||
|
||||
if (newNippleProgress == nippleProgress) return; // Nothing to change
|
||||
else if (newNippleProgress > nippleProgress)
|
||||
{
|
||||
float progressDifference = newNippleProgress - nippleProgress;
|
||||
// All nipple growth has a slight effect on the base
|
||||
// Not mathematically precise in hitting the goal at the end of the term, but close enough
|
||||
baseAlpha *= 1.0f + progressDifference * Configurations.PermanentNippleChange;
|
||||
if (baseAlpha > 1.0f) baseAlpha = 1.0f;
|
||||
baseAreola *= 1.0f + progressDifference * Configurations.PermanentNippleChange;
|
||||
if (baseAreola > 1.0f) baseAreola = 1.0f;
|
||||
baseNipple *= 1.0f + progressDifference * Configurations.PermanentNippleChange;
|
||||
if (baseNipple > 1.0f) baseNipple = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
nippleProgress -= tickInterval / (BabyHalfAge * GenDate.TicksPerYear);
|
||||
if (nippleProgress < newNippleProgress) nippleProgress = newNippleProgress;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeColor(float alpha)
|
||||
public void AdjustNippleProgress(float amount)
|
||||
{
|
||||
this.alpha = alpha;
|
||||
nippleProgress = Mathf.Clamp01(nippleProgress + amount);
|
||||
}
|
||||
|
||||
public void PregnancyTransition()
|
||||
public void AdjustNippleSizeImmediately(float amount)
|
||||
{
|
||||
alphaPermanent = Math.Min(MaxAlpha, alphaPermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
|
||||
areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
|
||||
nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + Configurations.NipplePermanentTransitionVariance.VariationRange(VARIANT));
|
||||
alpha = Math.Min(MaxAlpha, alpha + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
|
||||
areolaSize = Math.Min(MaxAreola, areolaSize + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
|
||||
nippleSize = Math.Min(MaxNipple, nippleSize + Configurations.NippleTransitionVariance.VariationRange(VARIANT));
|
||||
pregnant = true;
|
||||
baseNipple = Mathf.Clamp01(baseNipple + amount);
|
||||
UpdateNipples();
|
||||
}
|
||||
|
||||
public void BirthTransition()
|
||||
public void AdjustAreolaSizeImmediately(float amount)
|
||||
{
|
||||
alpha = alphaPermanent;
|
||||
areolaSize = areolaSizePermanent;
|
||||
nippleSize = nippleSizePermanent;
|
||||
pregnant = false;
|
||||
ageOfLastBirth = parent.pawn.ageTracker.AgeBiologicalTicks;
|
||||
baseAreola = Mathf.Clamp01(baseAreola + amount);
|
||||
UpdateNipples();
|
||||
}
|
||||
|
||||
|
||||
public void AdjustBreastSize(float amount)
|
||||
public void UpdateNipples()
|
||||
{
|
||||
parent.Severity += amount;
|
||||
breastSizeIncreased += amount;
|
||||
cachedAlpha = baseAlpha + nippleProgress * nippleChange;
|
||||
cachedAreola = baseAreola + nippleProgress * maxAreolaIncrement;
|
||||
cachedNipple = baseNipple + nippleProgress * nippleChange;
|
||||
|
||||
cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
|
||||
}
|
||||
|
||||
public void AdjustNippleSize(float amount)
|
||||
protected int GetNextUpdate()
|
||||
{
|
||||
nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + amount);
|
||||
nippleSize = Math.Min(MaxNipple, nippleSize + amount);
|
||||
}
|
||||
// Just like the menstruation code
|
||||
int currentOffset = Find.TickManager.TicksGame % tickInterval;
|
||||
int nextOffset = (parent.pawn.HashOffset() % tickInterval + tickInterval) % tickInterval;
|
||||
|
||||
public void AdjustAreolaSize(float amount)
|
||||
{
|
||||
areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + amount);
|
||||
areolaSize = Math.Min(MaxAreola, areolaSize + amount);
|
||||
}
|
||||
|
||||
public void RestoreBreastSize(float ratio)
|
||||
{
|
||||
float variance = breastSizeIncreased * Math.Min(ratio, 1.0f);
|
||||
breastSizeIncreased -= variance;
|
||||
parent.Severity -= variance;
|
||||
}
|
||||
|
||||
public void AdjustNippleSizeImmidiately(float amount)
|
||||
{
|
||||
originnipple = Math.Max(0, originnipple + amount);
|
||||
nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + amount);
|
||||
nippleSize = Math.Min(MaxNipple, nippleSize + amount);
|
||||
nippleSizeCurrent = nippleSize;
|
||||
}
|
||||
|
||||
public void AdjustAreolaSizeImmidiately(float amount)
|
||||
{
|
||||
originareola = Math.Max(0, originareola + amount);
|
||||
areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + amount);
|
||||
areolaSize = Math.Min(MaxAreola, areolaSize + amount);
|
||||
areolaSizeCurrent = areolaSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void UpdateColor()
|
||||
{
|
||||
cachedcolor = Colors.CMYKLerp(parent?.pawn?.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha);
|
||||
return ((nextOffset - currentOffset + tickInterval - 1) % tickInterval) + 1;
|
||||
}
|
||||
|
||||
public void CopyBreastProperties(HediffComp_Breast original)
|
||||
{
|
||||
alphaPermanent = original.alphaPermanent;
|
||||
alphaCurrent = original.alphaCurrent;
|
||||
alpha = original.alpha;
|
||||
areolaSizePermanent = original.areolaSizePermanent;
|
||||
areolaSizeCurrent = original.areolaSizeCurrent;
|
||||
areolaSize = original.areolaSize;
|
||||
nippleSizePermanent = original.nippleSizePermanent;
|
||||
nippleSizeCurrent = original.nippleSizeCurrent;
|
||||
nippleSize = original.nippleSize;
|
||||
originalpha = original.originalpha;
|
||||
originareola = original.originareola;
|
||||
originnipple = original.originnipple;
|
||||
cachedcolor = original.cachedcolor;
|
||||
maxBreastIncrement = original.maxBreastIncrement;
|
||||
maxAreolaIncrement = original.maxAreolaIncrement;
|
||||
baseAlpha = original.baseAlpha;
|
||||
baseAreola = original.baseAreola;
|
||||
baseNipple = original.baseNipple;
|
||||
UpdateNipples();
|
||||
}
|
||||
|
||||
public string DebugInfo()
|
||||
{
|
||||
return "Increase: " + breastSizeIncreased +
|
||||
return "Size: " + parent.Severity +
|
||||
"\nIncrease: " + breastSizeIncreased +
|
||||
"\n" + debugGrowthStatus +
|
||||
"\nAlpha: " + alpha +
|
||||
"\nNippleSize: " + nippleSize +
|
||||
"\nAreolaSize: " + areolaSize +
|
||||
"\nAlphaCurrent: " + alphaCurrent +
|
||||
"\nNippleSizeCurrent: " + nippleSizeCurrent +
|
||||
"\nAreolaSizeCurrent: " + areolaSizeCurrent +
|
||||
"\nAlphaOrigin: " + originalpha +
|
||||
"\nNippleSizeOrigin: " + originnipple +
|
||||
"\nAreolaSizeOrigin: " + originareola +
|
||||
"\nAlphaMax: " + MaxAlpha +
|
||||
"\nNippleSizeMax: " + MaxNipple +
|
||||
"\nAreolaSizeMax: " + MaxAreola +
|
||||
"\nPermanentAlpha:" + alphaPermanent +
|
||||
"\nPermanentNipple:" + nippleSizePermanent +
|
||||
"\nPermanentAreola:" + areolaSizePermanent;
|
||||
"\nNipple progress: " + nippleProgress +
|
||||
"\nBase alpha: " + baseAlpha +
|
||||
"\nAlpha: " + cachedAlpha +
|
||||
"\nBase areola: " + baseAreola +
|
||||
"\nAreola: " + cachedAreola +
|
||||
"\nDisplayed areola: " + AreolaSize +
|
||||
"\nBase nipple: " + baseNipple +
|
||||
"\nNipple: " + cachedNipple +
|
||||
"\nDisplayed nipple: " + NippleSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1394,10 +1394,6 @@ namespace RJW_Menstruation
|
|||
EggDecay();
|
||||
if (Implant())
|
||||
{
|
||||
if (Breast != null)
|
||||
{
|
||||
Breast.PregnancyTransition();
|
||||
}
|
||||
GoNextStage(Stage.Pregnant);
|
||||
}
|
||||
else
|
||||
|
@ -1459,10 +1455,6 @@ namespace RJW_Menstruation
|
|||
else
|
||||
{
|
||||
if (pregnancy != null) pregnancy = null;
|
||||
if (Breast != null)
|
||||
{
|
||||
Breast.BirthTransition();
|
||||
}
|
||||
GoNextStage(Stage.Recover);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
protected override void SurgeryResult(HediffComp_Breast breast)
|
||||
{
|
||||
breast.AdjustAreolaSizeImmidiately(0.1f);
|
||||
breast.AdjustAreolaSizeImmediately(0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
protected override void SurgeryResult(HediffComp_Breast breast)
|
||||
{
|
||||
breast.AdjustAreolaSizeImmidiately(-0.1f);
|
||||
breast.AdjustAreolaSizeImmediately(-0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
protected override void SurgeryResult(HediffComp_Breast breast)
|
||||
{
|
||||
breast.AdjustNippleSizeImmidiately(0.1f);
|
||||
breast.AdjustNippleSizeImmediately(0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
protected override void SurgeryResult(HediffComp_Breast breast)
|
||||
{
|
||||
breast.AdjustNippleSizeImmidiately(-0.1f);
|
||||
breast.AdjustNippleSizeImmediately(-0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,14 +98,6 @@ namespace RJW_Menstruation
|
|||
public static readonly string Option23_Label = "Option23_Label".Translate();
|
||||
public static readonly string Option23_Label_1 = "Option23_Label_1".Translate();
|
||||
public static readonly string Option23_Label_2 = "Option23_Label_2".Translate();
|
||||
public static readonly string Option24_Label = "Option24_Label".Translate();
|
||||
public static readonly string Option24_Desc = "Option24_Desc".Translate();
|
||||
public static readonly string Option25_Label = "Option25_Label".Translate();
|
||||
public static readonly string Option25_Desc = "Option25_Desc".Translate();
|
||||
public static readonly string Option26_Label = "Option26_Label".Translate();
|
||||
public static readonly string Option26_Desc = "Option26_Desc".Translate();
|
||||
public static readonly string Option27_Label = "Option27_Label".Translate();
|
||||
public static readonly string Option27_Desc = "Option27_Desc".Translate();
|
||||
public static readonly string Option28_Label = "Option28_Label".Translate();
|
||||
public static readonly string Option28_Tooltip = "Option28_Tooltip".Translate();
|
||||
public static readonly string Option29_Label = "Option29_Label".Translate();
|
||||
|
@ -116,6 +108,12 @@ namespace RJW_Menstruation
|
|||
public static readonly string Option31_Desc = "Option31_Desc".Translate();
|
||||
public static readonly string Option32_Label = "Option32_Label".Translate();
|
||||
public static readonly string Option32_Desc = "Option32_Desc".Translate();
|
||||
public static readonly string Option_MaxBreastIncrementFactor_Label = "Option_MaxBreastIncrementFactor_Label".Translate();
|
||||
public static readonly string Option_MaxBreastIncrementFactor_Desc = "Option_MaxBreastIncrementFactor_Desc".Translate();
|
||||
public static readonly string Option_MaxNippleIncrementFactor_Label = "Option_MaxNippleIncrementFactor_Label".Translate();
|
||||
public static readonly string Option_MaxNippleIncrementFactor_Desc = "Option_MaxNippleIncrementFactor_Desc".Translate();
|
||||
public static readonly string Option_PermanentNippleChange_Label = "Option_PermanentNippleChange_Label".Translate();
|
||||
public static readonly string Option_PermanentNippleChange_Desc = "Option_PermanentNippleChange_Desc".Translate();
|
||||
public static readonly string Option_EnableGatherCumGizmo_Label = "Option_EnableGatherCumGizmo_Label".Translate();
|
||||
public static readonly string Option_EstrusOverride_Label = "Option_EstrusOverride_Label".Translate();
|
||||
public static readonly string Option_EstrusOverride_Desc = "Option_EstrusOverride_Desc".Translate();
|
||||
|
|
|
@ -370,7 +370,7 @@ namespace RJW_Menstruation
|
|||
|
||||
|
||||
|
||||
pawn.DrawBreastIcon(BreastIconRect, Mouse.IsOver(BreastIconRect) && Input.GetMouseButton(0));
|
||||
pawn.DrawBreastIcon(BreastIconRect);
|
||||
|
||||
|
||||
GUI.color = Color.white;
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace RJW_Menstruation
|
|||
}
|
||||
}
|
||||
|
||||
public static void DrawBreastIcon(this Pawn pawn, Rect rect, bool drawOrigin = false)
|
||||
public static void DrawBreastIcon(this Pawn pawn, Rect rect)
|
||||
{
|
||||
Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("breast"));
|
||||
Texture2D breast, nipple, areola;
|
||||
|
@ -191,16 +191,8 @@ namespace RJW_Menstruation
|
|||
|
||||
string nippleicon, areolaicon;
|
||||
float nipplesize, areolasize;
|
||||
if (drawOrigin)
|
||||
{
|
||||
nipplesize = comp.OriginNipple;
|
||||
areolasize = comp.OriginAreola;
|
||||
}
|
||||
else
|
||||
{
|
||||
nipplesize = comp.NippleSize;
|
||||
areolasize = comp.AreolaSize;
|
||||
}
|
||||
|
||||
nippleicon = icon + "_Nipple0" + GetNippleIndex(nipplesize);
|
||||
areolaicon = icon + "_Areola0" + GetAreolaIndex(areolasize);
|
||||
|
@ -212,14 +204,8 @@ namespace RJW_Menstruation
|
|||
GUI.color = pawn.story.SkinColor;
|
||||
GUI.DrawTexture(rect, breast, ScaleMode.ScaleToFit);
|
||||
|
||||
if (drawOrigin)
|
||||
{
|
||||
GUI.color = comp.OriginColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = comp.NippleColor;
|
||||
}
|
||||
|
||||
GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit);
|
||||
|
||||
GUI.DrawTexture(rect, nipple, ScaleMode.ScaleToFit);
|
||||
|
|
Loading…
Reference in a new issue