diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index bd3e682..1ef9e7f 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index 5f94980..c83daef 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -94,12 +94,11 @@ namespace RJW_Menstruation Pawn baby = PawnGenerator.GeneratePawn(request); if (baby == null) break; PregnancyCommon.SetupBabyXenotype(mother, father, baby); // Probably redundant with Biotech post-birth xenotyping + baby.Drawer.renderer.graphics.ResolveAllGraphics(); if (division > 1) { if (i == 0) { - if (baby.IsHAR()) - baby.Drawer.renderer.graphics.ResolveAllGraphics(); firstbaby = baby; request.FixedGender = baby.gender; request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); @@ -114,6 +113,7 @@ namespace RJW_Menstruation baby.story.hairDef = firstbaby.story.hairDef; baby.story.bodyType = firstbaby.story.bodyType; baby.story.furDef = firstbaby.story.furDef; + baby.story.skinColorOverride = firstbaby.story.skinColorOverride; } if (baby.genes != null) @@ -163,6 +163,8 @@ namespace RJW_Menstruation Pawn baby = comp.PopBaby(); if (baby == null) return PawnGenerator.GeneratePawn(request); // Shouldn't happen + baby.ageTracker.AgeBiologicalTicks = 0; + baby.ageTracker.AgeChronologicalTicks = 0; if (request.ForceDead) baby.Kill(null, null); return baby; } @@ -281,4 +283,18 @@ namespace RJW_Menstruation } } } + + // HAR patches ApplyBirthOutcome to produce multiple babies based on the mother's littersize. But the pregenerated babies system already makes multiple babies + // So make it always consider the mother to have one baby + public static class HAR_LitterSize_Undo + { + public static void Postfix(ref int __result, Pawn mother) + { + if (Configurations.PregnancySource != Configurations.PregnancyType.Biotech || !Configurations.EnableBiotechTwins) return; + // 'mother' is the genetic mother, but unless she's in labor at the same time the birtherthing is spitting out, this will work as intended + if (mother?.health.hediffSet.GetFirstHediff()?.TryGetComp()?.HasBaby ?? false) + __result = 0; + return; + } + } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index 0d44d2e..907b36a 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -331,12 +331,14 @@ namespace RJW_Menstruation Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed); if (baby == null) break; PregnancyCommon.SetupBabyXenotype(mother, father, baby); + // HAR and some xenotype mods don't randomize graphics until it's rendered + // So poke it early + baby.Drawer.renderer.graphics.ResolveAllGraphics(); if (division > 1) { if (i == 0) - { - if (baby.IsHAR()) // Have HAR determine the first baby's properties - baby.Drawer.renderer.graphics.ResolveAllGraphics(); + { + firstbaby = baby; request.FixedGender = baby.gender; request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); @@ -351,6 +353,7 @@ namespace RJW_Menstruation baby.story.hairDef = firstbaby.story.hairDef; baby.story.bodyType = firstbaby.story.bodyType; baby.story.furDef = firstbaby.story.furDef; + baby.story.skinColorOverride = firstbaby.story.skinColorOverride; } if (baby.genes != null && ModsConfig.BiotechActive) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs index d701d49..29978fd 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs @@ -1,4 +1,5 @@ -using HarmonyLib; +using AlienRace; +using HarmonyLib; using rjw; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Rules.PartKindUsageRules; @@ -16,6 +17,11 @@ namespace RJW_Menstruation { Harmony har = new Harmony("RJW_Menstruation"); har.PatchAll(Assembly.GetExecutingAssembly()); + if (ModsConfig.IsActive("erdelf.HumanoidAlienRaces")) // Don't use the cached in Configurations, it isn't initialized yet + { + har.Patch(typeof(AlienRace.HarmonyPatches).GetMethod(nameof(AlienRace.HarmonyPatches.BirthOutcomeMultiplier)), + postfix: new HarmonyMethod(typeof(HAR_LitterSize_Undo).GetMethod(nameof(HAR_LitterSize_Undo.Postfix)))); + } InjectIntoRjwInteractionServices(); }