Pawn.RaceProps is equivalent to Pawn.def.race, so be consistent with it

This commit is contained in:
lutepickle 2023-04-29 20:32:46 -07:00
parent 6dc73a848e
commit 270ac427c8
5 changed files with 10 additions and 10 deletions

View file

@ -69,7 +69,7 @@ namespace RJW_Menstruation
get
{
if (babyHalfAge > 0f) return babyHalfAge;
List<LifeStageAge> ages = Pawn.def.race.lifeStageAges;
List<LifeStageAge> ages = Pawn.RaceProps.lifeStageAges;
if (ages?.Count > 1)
babyHalfAge = ages[1].minAge / 2;

View file

@ -43,7 +43,7 @@ namespace RJW_Menstruation
protected override float RaceCyclesPerYear()
{
// Don't bother with breeding season, since so much time is planned to be spent pregnant.
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.def.race.gestationPeriodDays);
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.RaceProps.gestationPeriodDays);
return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault;
}

View file

@ -196,7 +196,7 @@ namespace RJW_Menstruation
float avglittersize;
try
{
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f);
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.RaceProps.litterSizeCurve), 1.0f);
}
catch
{
@ -208,7 +208,7 @@ namespace RJW_Menstruation
opcache = (int)(RaceCyclesPerYear() *
avglittersize *
yearsBeforeMenopause *
(Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
(Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
if (opcache == 0) opcache = 1;
return opcache;
}
@ -555,7 +555,7 @@ namespace RJW_Menstruation
{
try
{
Color c = Pawn.def.race.BloodDef.graphicData.color;
Color c = Pawn.RaceProps.BloodDef.graphicData.color;
return c;
}
catch
@ -1217,7 +1217,7 @@ namespace RJW_Menstruation
float avglittersize;
try
{
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f);
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.RaceProps.litterSizeCurve), 1.0f);
}
catch (NullReferenceException)
{
@ -1480,7 +1480,7 @@ namespace RJW_Menstruation
{
// ~1.5 per hour times acceleration
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * TickInterval / GenDate.TicksPerHour;
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood);
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
Cum blood = GetNotCum(Translations.Menstrual_Blood);
if (blood != null) blood.Color = BloodColor;
}
@ -1602,7 +1602,7 @@ namespace RJW_Menstruation
float eggnum;
try
{
eggnum = Math.Max(Rand.ByCurve(Pawn.def.race.litterSizeCurve), 1f);
eggnum = Math.Max(Rand.ByCurve(Pawn.RaceProps.litterSizeCurve), 1f);
}
catch (NullReferenceException)
{

View file

@ -349,7 +349,7 @@ namespace RJW_Menstruation
else if (hediff is Hediff_BasePregnancy rjw_preg)
return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour;
// TODO: Biotech pregnancy
else return hediff.pawn.def.race.gestationPeriodDays * GenDate.HoursPerDay;
else return hediff.pawn.RaceProps.gestationPeriodDays * GenDate.HoursPerDay;
}
public static float RandomVariabilityPercent(int recursion = 0)

View file

@ -53,7 +53,7 @@ namespace RJW_Menstruation
if (pawn.kindDef?.race == pawn.def) return pawn.kindDef;
return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ??
VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ??
pawn.def.race?.AnyPawnKind ??
pawn.RaceProps?.AnyPawnKind ??
pawn.kindDef;
}