Put a warning in the log when loading a pregnancy with mother == father

This commit is contained in:
lutepickle 2024-07-31 07:22:20 -07:00
parent 4be4d881d5
commit f70c2ad585

View file

@ -639,10 +639,14 @@ namespace RJW_Menstruation
if (Scribe.mode == LoadSaveMode.PostLoadInit) if (Scribe.mode == LoadSaveMode.PostLoadInit)
{ {
Initialize(); Initialize();
if (pregnancy is HediffWithParents vanillaPreg && vanillaPreg.Mother == vanillaPreg.Father) // Fix mother == father issue // Biotech labor errors if the mother is also the father, so don't let that happen
if (pregnancy is HediffWithParents vanillaPreg && vanillaPreg.Mother == vanillaPreg.Father && vanillaPreg.Mother != null)
{
Log.Warning($"Pregnancy of {Pawn} has same mother and father, setting father to null");
vanillaPreg.SetParents(vanillaPreg.Mother, null, vanillaPreg.geneSet); vanillaPreg.SetParents(vanillaPreg.Mother, null, vanillaPreg.geneSet);
} }
} }
}
public override void CompPostPostAdd(DamageInfo? dinfo) public override void CompPostPostAdd(DamageInfo? dinfo)