Little refactor in CalculateLastBirth

This commit is contained in:
lutepickle 2022-07-29 20:35:49 -07:00
parent 4b6b4c87ee
commit 6701785462

View file

@ -3,6 +3,7 @@ using RimWorld;
using rjw; using rjw;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
@ -187,15 +188,12 @@ namespace RJW_Menstruation
foreach (Pawn child in parent.pawn.relations.Children) foreach (Pawn child in parent.pawn.relations.Children)
{ {
bool isFetus = false; bool isFetus = false;
foreach (Hediff_BasePregnancy preg in parent.pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>()) if (parent.pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>().Any(preg => preg.babies.Contains(child)))
{ {
if (preg.babies.Contains(child)) isFetus = true;
{ break;
isFetus = true;
break;
}
} }
if ( if (
parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth && parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth &&
!isFetus && !isFetus &&