mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Compare commits
4 commits
d34c96315a
...
2cb26ea016
Author | SHA1 | Date | |
---|---|---|---|
|
2cb26ea016 | ||
|
b9bfad10bb | ||
|
7d8228e03a | ||
|
93566b5fa3 |
4 changed files with 31 additions and 6 deletions
Binary file not shown.
|
@ -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<Hediff_LaborPushing>()?.TryGetComp<HediffComp_PregeneratedBabies>()?.HasBaby ?? false)
|
||||
__result = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue