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

View file

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