Refactor HighestEstrus

This commit is contained in:
lutepickle 2024-05-14 21:15:49 -07:00
parent 2516ed1439
commit c9c5e70246

View file

@ -395,23 +395,10 @@ namespace RJW_Menstruation
public static HediffComp_Menstruation.EstrusLevel HighestEstrus(this Pawn pawn)
{
HediffComp_Menstruation.EstrusLevel res = HediffComp_Menstruation.EstrusLevel.None;
foreach(HediffComp_Menstruation comp in pawn.GetMenstruationComps())
{
switch (comp.GetEstrusLevel())
{
case HediffComp_Menstruation.EstrusLevel.None:
break;
case HediffComp_Menstruation.EstrusLevel.Concealed:
res = HediffComp_Menstruation.EstrusLevel.Concealed;
break;
case HediffComp_Menstruation.EstrusLevel.Visible:
return HediffComp_Menstruation.EstrusLevel.Visible;
}
}
return res;
return pawn.GetMenstruationComps().
Select(comp => comp.GetEstrusLevel()).
DefaultIfEmpty(HediffComp_Menstruation.EstrusLevel.None).
Max();
}
public static bool HasIUD(this Pawn pawn)