diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index 42d8d78..25029ea 100644 Binary files a/1.3/Assemblies/RJW_Menstruation.dll and b/1.3/Assemblies/RJW_Menstruation.dll differ diff --git a/1.3/Languages/English/Keyed/RJW_Menstruation.xml b/1.3/Languages/English/Keyed/RJW_Menstruation.xml index bdb4a6f..908b411 100644 --- a/1.3/Languages/English/Keyed/RJW_Menstruation.xml +++ b/1.3/Languages/English/Keyed/RJW_Menstruation.xml @@ -37,7 +37,7 @@ Gather cum into bucket Store cum in womb Unknown - + Enable womb icon @@ -94,14 +94,12 @@ Dominant hybrid extension Mother Father - Transition variance of nipples after pregnancy - Set how much nipples/areolas should darken/widen on every pregnancy. - Permanent transition variance of nipples - Set how much nipples/areolas should darken/widen permanently on every pregnancy. - Maximum transition - Nipples/areolas won't be darker/wider than this value. - Transition speed of nipples - Set speed of transition of nipples/areolas. 1 = instant transition + Breast growth during pregnancy + Change how much a pregnant pawn's breasts will grow when pregnant. Some pawns will grow more than others. + Nipple change during pregnancy + Change how much a pregnant pawn's nipples will change during pregnancy. + Permanent nipple change after pregnancy + Adjusts approximately how much of a pregnant pawn's nipples will remain changed after the pregnancy ends. Customize Hybrids Open custom hybrid editor. This will overrides hybrid definitions of XML files. Allow shrink icon diff --git a/1.3/MilkModule/Assemblies/MilkModule.dll b/1.3/MilkModule/Assemblies/MilkModule.dll index 778684a..5061b43 100644 Binary files a/1.3/MilkModule/Assemblies/MilkModule.dll and b/1.3/MilkModule/Assemblies/MilkModule.dll differ diff --git a/1.3/source/RJW_Menstruation/MilkModule/JobDriver_MilkSelf.cs b/1.3/source/RJW_Menstruation/MilkModule/JobDriver_MilkSelf.cs index b35b0a6..0a73ead 100644 --- a/1.3/source/RJW_Menstruation/MilkModule/JobDriver_MilkSelf.cs +++ b/1.3/source/RJW_Menstruation/MilkModule/JobDriver_MilkSelf.cs @@ -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)); } } diff --git a/1.3/source/RJW_Menstruation/MilkModule/Milk_Patch.cs b/1.3/source/RJW_Menstruation/MilkModule/Milk_Patch.cs index 2de9e87..ee5ec1d 100644 --- a/1.3/source/RJW_Menstruation/MilkModule/Milk_Patch.cs +++ b/1.3/source/RJW_Menstruation/MilkModule/Milk_Patch.cs @@ -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)); } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 2ef752e..7309459 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -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); } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index b3abfe3..b045331 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -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 ages = parent.pawn.RaceProps.lifeStageAges; + if (babyHalfAge >= 0f) return babyHalfAge; + List 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; } - } - } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 316a424..a60d36f 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -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); } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs index 6a1f8b8..c34c0e9 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs @@ -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); } } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index 6189613..320763d 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -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(); diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index 21ed45b..64bef90 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -370,7 +370,7 @@ namespace RJW_Menstruation - pawn.DrawBreastIcon(BreastIconRect, Mouse.IsOver(BreastIconRect) && Input.GetMouseButton(0)); + pawn.DrawBreastIcon(BreastIconRect); GUI.color = Color.white; diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 38d40a3..6ba0a80 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -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; - } + 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.color = comp.NippleColor; + GUI.DrawTexture(rect, areola, ScaleMode.ScaleToFit); GUI.DrawTexture(rect, nipple, ScaleMode.ScaleToFit);