mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Add new function to test for RJW pregnancy (as opposed to a vanilla animal pregnancy), and refactor GetFarthestPregnancy into the rimworld fallback version
This commit is contained in:
parent
5eb73bfb2e
commit
e023938a41
3 changed files with 8 additions and 6 deletions
|
@ -265,7 +265,7 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Scenario B: Pregnant, grow in the second half of first trimester
|
// Scenario B: Pregnant, grow in the second half of first trimester
|
||||||
else if (parent.pawn.IsPregnant())
|
else if (parent.pawn.IsRJWPregnant())
|
||||||
{
|
{
|
||||||
float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, parent.pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
|
float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, parent.pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
|
||||||
if (breastSizeIncreased > pregnancySize)
|
if (breastSizeIncreased > pregnancySize)
|
||||||
|
@ -301,7 +301,7 @@ namespace RJW_Menstruation
|
||||||
float newNippleProgress;
|
float newNippleProgress;
|
||||||
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks)
|
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks)
|
||||||
newNippleProgress = 1f;
|
newNippleProgress = 1f;
|
||||||
else if (parent.pawn.IsPregnant())
|
else if (parent.pawn.IsRJWPregnant())
|
||||||
newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress());
|
newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress());
|
||||||
else
|
else
|
||||||
newNippleProgress = 0f;
|
newNippleProgress = 0f;
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace RJW_Menstruation
|
||||||
"eggs: " + comp.GetNumofEggs + "\n";
|
"eggs: " + comp.GetNumofEggs + "\n";
|
||||||
}
|
}
|
||||||
else description += comp.GetCurStageLabel + "\n";
|
else description += comp.GetCurStageLabel + "\n";
|
||||||
if (pawn.IsPregnant())
|
if (pawn.IsRJWPregnant())
|
||||||
{
|
{
|
||||||
Hediff_BasePregnancy hediff = comp.Pregnancy;
|
Hediff_BasePregnancy hediff = comp.Pregnancy;
|
||||||
if (hediff != null && Utility.ShowFetusImage(hediff))
|
if (hediff != null && Utility.ShowFetusImage(hediff))
|
||||||
|
|
|
@ -135,12 +135,14 @@ namespace RJW_Menstruation
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsRJWPregnant(this Pawn pawn)
|
||||||
|
{
|
||||||
|
return pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any();
|
||||||
|
}
|
||||||
|
|
||||||
public static float GetFarthestPregnancyProgress(this Pawn pawn)
|
public static float GetFarthestPregnancyProgress(this Pawn pawn)
|
||||||
{
|
{
|
||||||
IEnumerable<Hediff_BasePregnancy> pregnancies = pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>();
|
return pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().MaxByWithFallback(hediff => hediff.GestationProgress)?.GestationProgress ?? 0;
|
||||||
if (!pregnancies.Any()) return 0;
|
|
||||||
else return pregnancies.MaxBy(hediff => hediff.GestationProgress)?.GestationProgress ?? 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float GetPregnancyProgress(this HediffComp_Menstruation comp)
|
public static float GetPregnancyProgress(this HediffComp_Menstruation comp)
|
||||||
|
|
Loading…
Reference in a new issue