Compare commits

..

No commits in common. "2cb26ea0162af1f3186c5abc125190f799210927" and "d34c96315afebe79a255e0633cad05984b767488" have entirely different histories.

4 changed files with 6 additions and 31 deletions

Binary file not shown.

View file

@ -94,11 +94,12 @@ namespace RJW_Menstruation
Pawn baby = PawnGenerator.GeneratePawn(request); Pawn baby = PawnGenerator.GeneratePawn(request);
if (baby == null) break; if (baby == null) break;
PregnancyCommon.SetupBabyXenotype(mother, father, baby); // Probably redundant with Biotech post-birth xenotyping PregnancyCommon.SetupBabyXenotype(mother, father, baby); // Probably redundant with Biotech post-birth xenotyping
baby.Drawer.renderer.graphics.ResolveAllGraphics();
if (division > 1) if (division > 1)
{ {
if (i == 0) if (i == 0)
{ {
if (baby.IsHAR())
baby.Drawer.renderer.graphics.ResolveAllGraphics();
firstbaby = baby; firstbaby = baby;
request.FixedGender = baby.gender; request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
@ -113,7 +114,6 @@ namespace RJW_Menstruation
baby.story.hairDef = firstbaby.story.hairDef; baby.story.hairDef = firstbaby.story.hairDef;
baby.story.bodyType = firstbaby.story.bodyType; baby.story.bodyType = firstbaby.story.bodyType;
baby.story.furDef = firstbaby.story.furDef; baby.story.furDef = firstbaby.story.furDef;
baby.story.skinColorOverride = firstbaby.story.skinColorOverride;
} }
if (baby.genes != null) if (baby.genes != null)
@ -163,8 +163,6 @@ namespace RJW_Menstruation
Pawn baby = comp.PopBaby(); Pawn baby = comp.PopBaby();
if (baby == null) return PawnGenerator.GeneratePawn(request); // Shouldn't happen 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); if (request.ForceDead) baby.Kill(null, null);
return baby; return baby;
} }
@ -283,18 +281,4 @@ 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<Hediff_LaborPushing>()?.TryGetComp<HediffComp_PregeneratedBabies>()?.HasBaby ?? false)
__result = 0;
return;
}
}
} }

View file

@ -331,14 +331,12 @@ namespace RJW_Menstruation
Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed); Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed);
if (baby == null) break; if (baby == null) break;
PregnancyCommon.SetupBabyXenotype(mother, father, baby); 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 (division > 1)
{ {
if (i == 0) if (i == 0)
{ {
if (baby.IsHAR()) // Have HAR determine the first baby's properties
baby.Drawer.renderer.graphics.ResolveAllGraphics();
firstbaby = baby; firstbaby = baby;
request.FixedGender = baby.gender; request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
@ -353,7 +351,6 @@ namespace RJW_Menstruation
baby.story.hairDef = firstbaby.story.hairDef; baby.story.hairDef = firstbaby.story.hairDef;
baby.story.bodyType = firstbaby.story.bodyType; baby.story.bodyType = firstbaby.story.bodyType;
baby.story.furDef = firstbaby.story.furDef; baby.story.furDef = firstbaby.story.furDef;
baby.story.skinColorOverride = firstbaby.story.skinColorOverride;
} }
if (baby.genes != null && ModsConfig.BiotechActive) if (baby.genes != null && ModsConfig.BiotechActive)

View file

@ -1,5 +1,4 @@
using AlienRace; using HarmonyLib;
using HarmonyLib;
using rjw; using rjw;
using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Rules.PartKindUsageRules; using rjw.Modules.Interactions.Rules.PartKindUsageRules;
@ -17,11 +16,6 @@ namespace RJW_Menstruation
{ {
Harmony har = new Harmony("RJW_Menstruation"); Harmony har = new Harmony("RJW_Menstruation");
har.PatchAll(Assembly.GetExecutingAssembly()); 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(); InjectIntoRjwInteractionServices();
} }