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 get
{ {
if (babyHalfAge > 0f) return babyHalfAge; if (babyHalfAge > 0f) return babyHalfAge;
List<LifeStageAge> ages = Pawn.def.race.lifeStageAges; List<LifeStageAge> ages = Pawn.RaceProps.lifeStageAges;
if (ages?.Count > 1) if (ages?.Count > 1)
babyHalfAge = ages[1].minAge / 2; babyHalfAge = ages[1].minAge / 2;

View File

@ -43,7 +43,7 @@ namespace RJW_Menstruation
protected override float RaceCyclesPerYear() protected override float RaceCyclesPerYear()
{ {
// Don't bother with breeding season, since so much time is planned to be spent pregnant. // 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; return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault;
} }

View File

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

View File

@ -349,7 +349,7 @@ namespace RJW_Menstruation
else if (hediff is Hediff_BasePregnancy rjw_preg) else if (hediff is Hediff_BasePregnancy rjw_preg)
return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour; return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour;
// TODO: Biotech pregnancy // 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) 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; if (pawn.kindDef?.race == pawn.def) return pawn.kindDef;
return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ?? return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ??
VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ?? VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ??
pawn.def.race?.AnyPawnKind ?? pawn.RaceProps?.AnyPawnKind ??
pawn.kindDef; pawn.kindDef;
} }