Correct PostFix to Postfix

This commit is contained in:
lutepickle 2023-03-12 17:27:04 -07:00
parent 699b3aa6d2
commit 9aab479fe6
3 changed files with 8 additions and 12 deletions

Binary file not shown.

View File

@ -26,33 +26,28 @@ namespace RJW_Menstruation
public static void Postfix(Hediff_Pregnant __instance) public static void Postfix(Hediff_Pregnant __instance)
{ {
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy(); HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s labor starting, menstruation comp is {comp}");
if (comp == null) return; if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLabor); comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLabor);
if (Configurations.Debug) Log.Message($"New pregnancy Hediff is {comp.Pregnancy}");
} }
} }
[HarmonyPatch(typeof(Hediff_Labor), nameof(Hediff_Labor.PreRemoved))] [HarmonyPatch(typeof(Hediff_Labor), nameof(Hediff_Labor.PreRemoved))]
public class Labor_PreRemoved_Patch public class Labor_PreRemoved_Patch
{ {
public static void PostFix(Hediff_Labor __instance) public static void Postfix(Hediff_Labor __instance)
{ {
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy(); HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s initial labor ending, menstruation comp is {comp}");
if (comp == null) return; if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLaborPushing); comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLaborPushing);
if (Configurations.Debug) Log.Message($"New pregnancy Hediff is {comp.Pregnancy}");
} }
} }
[HarmonyPatch(typeof(Hediff_LaborPushing), nameof(Hediff_LaborPushing.PreRemoved))] [HarmonyPatch(typeof(Hediff_LaborPushing), nameof(Hediff_LaborPushing.PreRemoved))]
public class LaborPushing_PreRemoved_Patch public class LaborPushing_PreRemoved_Patch
{ {
public static void PostFix(Hediff_LaborPushing __instance) public static void Postfix(Hediff_LaborPushing __instance)
{ {
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy(); HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (Configurations.Debug) Log.Message($"{comp.Pawn}'s labor pushing ending, menstruation comp is {comp}");
if (comp == null) return; if (comp == null) return;
comp.Pregnancy = null; comp.Pregnancy = null;
} }
@ -62,7 +57,7 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.GestationProgress), MethodType.Getter)] [HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.GestationProgress), MethodType.Getter)]
public class Hediff_Pregnant_GestationProgess_Patch public class Hediff_Pregnant_GestationProgess_Patch
{ {
public static void PostFix(Hediff_Pregnant __instance, ref float __result) public static void Postfix(Hediff_Pregnant __instance, ref float __result)
{ {
if (__result < 1f) return; if (__result < 1f) return;
Pawn pawn = __instance.pawn; Pawn pawn = __instance.pawn;
@ -74,7 +69,7 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(Recipe_ExtractOvum), nameof(Recipe_ExtractOvum.AvailableReport))] [HarmonyPatch(typeof(Recipe_ExtractOvum), nameof(Recipe_ExtractOvum.AvailableReport))]
public class ExtractOvum_AvailableReport_Patch public class ExtractOvum_AvailableReport_Patch
{ {
public static void PostFix(Thing thing, ref AcceptanceReport __result) public static void Postfix(Thing thing, ref AcceptanceReport __result)
{ {
if (!__result.Accepted) return; if (!__result.Accepted) return;
Pawn pawn = (Pawn)thing; Pawn pawn = (Pawn)thing;
@ -97,7 +92,7 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(Recipe_ExtractOvum), "OnSurgerySuccess")] [HarmonyPatch(typeof(Recipe_ExtractOvum), "OnSurgerySuccess")]
public class ExtractOvum_OnSurgerySuccess_Patch public class ExtractOvum_OnSurgerySuccess_Patch
{ {
public static void PostFix(Pawn pawn) public static void Postfix(Pawn pawn)
{ {
List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList(); List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList();
if (!comps.Any()) return; if (!comps.Any()) return;
@ -110,7 +105,7 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(Recipe_ImplantEmbryo), nameof(Recipe_ImplantEmbryo.ApplyOnPawn))] [HarmonyPatch(typeof(Recipe_ImplantEmbryo), nameof(Recipe_ImplantEmbryo.ApplyOnPawn))]
public class ImplantEmbryo_ApplyOnPawn_Patch public class ImplantEmbryo_ApplyOnPawn_Patch
{ {
public static void PostFix(Pawn pawn) public static void Postfix(Pawn pawn)
{ {
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
comp.TakeLoosePregnancy(); comp.TakeLoosePregnancy();
@ -120,7 +115,7 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome))] [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome))]
public class ApplyBirthOutcome_Breast_Patch public class ApplyBirthOutcome_Breast_Patch
{ {
public static void PostFix(Thing birtherThing) public static void Postfix(Thing birtherThing)
{ {
if (birtherThing is Pawn pawn && !pawn.health.Dead) if (birtherThing is Pawn pawn && !pawn.health.Dead)
pawn.GetBreastComp()?.GaveBirth(); pawn.GetBreastComp()?.GaveBirth();

View File

@ -1,6 +1,7 @@
Version 1.0.8.8 Version 1.0.8.8
- Fix pawns skipping straight to menopause instead of going through climacteric stages. - Fix pawns skipping straight to menopause instead of going through climacteric stages.
- Fix father appearing as "Null" in womb dialog for some Biotech pregnancies. - Fix father appearing as "Null" in womb dialog for some Biotech pregnancies.
- Other bug fixes
- Rework ovulation mechanics. A pawn's implantation chance is now dependent only on their age. - Rework ovulation mechanics. A pawn's implantation chance is now dependent only on their age.
- All other fertility-altering effects instead change the odds of ovulation occuring, rolled per-egg. This chance appears in the womb dialog. - All other fertility-altering effects instead change the odds of ovulation occuring, rolled per-egg. This chance appears in the womb dialog.
- If the chance of ovulation goes above 100%, the implantation chance is increased. - If the chance of ovulation goes above 100%, the implantation chance is increased.