Tiny refactor to a few gets

This commit is contained in:
lutepickle 2022-09-02 08:19:09 -07:00
parent 1f6f50a361
commit afe603058e
2 changed files with 11 additions and 18 deletions

View file

@ -162,24 +162,21 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (cums.NullOrEmpty()) return 0; return cums?.Sum(cum => cum.Volume) ?? 0;
return cums.Sum(cum => cum.Volume);
} }
} }
public float TotalFertCum public float TotalFertCum
{ {
get get
{ {
if (cums.NullOrEmpty()) return 0; return cums?.Sum(cum => cum.FertVolume) ?? 0;
return cums.Sum(cum => cum.FertVolume);
} }
} }
public float TotalCumPercent public float TotalCumPercent
{ {
get get
{ {
if (cums.NullOrEmpty()) return 0; return cums?.Sum(cum => cum.Volume) / Props.maxCumCapacity ?? 0;
return cums.Sum(cum => cum.Volume) / Props.maxCumCapacity;
} }
} }
public float CumCapacity public float CumCapacity
@ -333,8 +330,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (customwombtex == null) return Props.wombTex; return customwombtex ?? Props.wombTex;
else return customwombtex;
} }
set set
{ {
@ -345,8 +341,7 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (customvagtex == null) return Props.vagTex; return customvagtex ?? Props.vagTex;
else return customvagtex;
} }
set set
{ {
@ -382,8 +377,8 @@ namespace RJW_Menstruation
{ {
get get
{ {
if (eggs.NullOrEmpty() || cums.NullOrEmpty()) return false; if (eggs.NullOrEmpty()) return false;
return cums.Any(cum => cum.FertVolume > 0); return cums?.Any(cum => cum.FertVolume > 0) ?? false;
} }
} }
/// <summary> /// <summary>
@ -434,12 +429,11 @@ namespace RJW_Menstruation
} }
} }
} }
public int GetNumofEggs public int GetNumOfEggs
{ {
get get
{ {
if (eggs.NullOrEmpty()) return 0; return eggs?.Count ?? 0;
else return eggs.Count;
} }
} }
public Color BloodColor public Color BloodColor
@ -663,8 +657,7 @@ namespace RJW_Menstruation
/// <returns></returns> /// <returns></returns>
public Cum GetCum(Pawn pawn) public Cum GetCum(Pawn pawn)
{ {
if (cums.NullOrEmpty()) return null; return cums?.Find(cum => !cum.notcum && cum.pawn == pawn);
return cums.Find(cum => !cum.notcum && cum.pawn == pawn);
} }
/// <summary> /// <summary>

View file

@ -48,7 +48,7 @@ namespace RJW_Menstruation
(comp.Pregnancy is Hediff_MultiplePregnancy preg ? "due: " + preg.DueDate() + "\n" : "") + (comp.Pregnancy is Hediff_MultiplePregnancy preg ? "due: " + preg.DueDate() + "\n" : "") +
"fertcums: " + comp.TotalFertCum + "\n" + "fertcums: " + comp.TotalFertCum + "\n" +
"ovarypower: " + comp.ovarypower + "\n" + "ovarypower: " + comp.ovarypower + "\n" +
"eggs: " + comp.GetNumofEggs + "\n"; "eggs: " + comp.GetNumOfEggs + "\n";
} }
else description += comp.GetCurStageLabel + "\n"; else description += comp.GetCurStageLabel + "\n";
if (pawn.IsRJWPregnant()) if (pawn.IsRJWPregnant())