mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Erase unborn babies upon miscarriage.
This commit is contained in:
parent
1c62cb2293
commit
4febc97c73
2 changed files with 20 additions and 0 deletions
|
@ -161,6 +161,13 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Miscarried()
|
||||||
|
{
|
||||||
|
if (babies == null) return;
|
||||||
|
foreach (Pawn baby in babies)
|
||||||
|
baby.Destroy(DestroyMode.Vanish);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome_NewTemp))]
|
[HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome_NewTemp))]
|
||||||
|
@ -333,4 +340,14 @@ namespace RJW_Menstruation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.Miscarry))]
|
||||||
|
public static class Miscarry_Patch
|
||||||
|
{
|
||||||
|
public static void Postfix(Hediff_Pregnant __instance)
|
||||||
|
{
|
||||||
|
HediffComp_PregeneratedBabies comp = __instance.TryGetComp<HediffComp_PregeneratedBabies>();
|
||||||
|
if (comp != null) comp.Miscarried();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ namespace RJW_Menstruation
|
||||||
public override void Miscarry()
|
public override void Miscarry()
|
||||||
{
|
{
|
||||||
this.GetMenstruationCompFromPregnancy().Pregnancy = null;
|
this.GetMenstruationCompFromPregnancy().Pregnancy = null;
|
||||||
|
if (babies != null)
|
||||||
|
foreach (var baby in babies)
|
||||||
|
baby.Destroy(DestroyMode.Vanish);
|
||||||
base.Miscarry();
|
base.Miscarry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue