diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 0020d86..7da77a7 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -276,7 +276,10 @@ namespace RJW_Menstruation float res = 0; if (VariousDefOf.Hediff_Heavy_Lactating_Permanent != null) { - if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("hypermilkable")); + if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Permanent) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Natural) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Drug)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkablehuman")); else milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkable")); } else diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 16903b2..a3fdf4c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -158,7 +158,7 @@ namespace RJW_Menstruation public static readonly HediffDef Hediff_Lactating_Natural = DefDatabase.GetNamedSilentFail("Lactating_Natural"); public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Lactating_Permanent"); public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Heavy_Lactating_Permanent"); - public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamedSilentFail("LactateSelf_MC"); + public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamedSilentFail("MilkSelf"); // Defs from Sexperience Ideology public static readonly PreceptDef Pregnancy_Elevated = DefDatabase.GetNamedSilentFail("Pregnancy_Elevated"); diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 38fbb81..4c6681c 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -639,8 +639,12 @@ namespace RJW_Menstruation if (Scribe.mode == LoadSaveMode.PostLoadInit) { 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); + } } } @@ -790,7 +794,7 @@ namespace RJW_Menstruation { get { - if (Pawn.Dead) return null; + if (Pawn.Dead || !Pawn.ShouldCycle()) return null; StringBuilder tip = new StringBuilder(); tip.Append(Translations.Dialog_WombInfo01); tip.Append(": "); @@ -812,7 +816,11 @@ namespace RJW_Menstruation public override string CompDebugString() { - if (Pawn.Dead || curStage == Stage.None || curStage == Stage.Infertile || curStage == Stage.Pregnant) return null; + if (Pawn.Dead || + !Pawn.ShouldCycle() || + curStage == Stage.None || + curStage == Stage.Infertile || + curStage == Stage.Pregnant) return null; StringBuilder debugString = new StringBuilder(); debugString.Append($"Time to next state: "); debugString.Append(GenDate.ToStringTicksToPeriod(TicksToNextStage())); diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index db4bd06..d608249 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -242,7 +242,7 @@ namespace RJW_Menstruation bool isInduced = comp is HediffComp_InducedOvulator; if (comp.curStage == HediffComp_Menstruation.Stage.Follicular && isInduced && - comp.Pawn.jobs.curDriver is JobDriver_Sex job && + comp.Pawn.jobs?.curDriver is JobDriver_Sex job && job.Sexprops != null && !UsingCondom(comp.Pawn, job.Partner) && (job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration)) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs index 26a66eb..ef1c8b3 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs @@ -33,8 +33,12 @@ namespace RJW_Menstruation foreach (LocalTargetInfo t in selftargets) { - if (t.Pawn == pawn && pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t)); - break; + if (t.Pawn == pawn) + { + if (pawn.HasMenstruationComp() && pawn.ShouldCycle()) + opts.AddDistinct(MakeSelfMenu(pawn, t)); + break; + } } }