Let the pregnancy detector in the initialization pick up multiple pregnancies, just in case

This commit is contained in:
lutepickle 2022-07-21 19:18:48 -07:00
parent 3f3977b3c7
commit 52b0c3ab95
1 changed files with 12 additions and 6 deletions

View File

@ -885,13 +885,19 @@ namespace RJW_Menstruation
InitOvary();
if (pregnancy == null && // If there's no pregnancy registered in this womb...
PregnancyHelper.GetPregnancy(parent.pawn) is Hediff_BasePregnancy preg && // ...but the pawn is pregnant...
preg.GetMenstruationComp() == null) // ...and another womb doesn't have it, then pick it up
if (pregnancy == null)
{
currentIntervalHours = (int)preg.GestationHours();
curStage = Stage.Pregnant;
pregnancy = preg;
// If this womb isn't marked pregnant, search for pregnancies that have no womb and claim one
foreach (Hediff_BasePregnancy preg in parent.pawn.health.hediffSet.GetHediffs<Hediff_BasePregnancy>())
{
if (preg.GetMenstruationComp() == null)
{
currentIntervalHours = (int)preg.GestationHours();
curStage = Stage.Pregnant;
pregnancy = preg;
break;
}
}
}
if (parent.pawn.IsAnimal())