diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 721b3a7..eb6d422 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/MilkModule/Assemblies/MilkModule.dll b/1.4/MilkModule/Assemblies/MilkModule.dll index 20c9007..78e3a88 100644 Binary files a/1.4/MilkModule/Assemblies/MilkModule.dll and b/1.4/MilkModule/Assemblies/MilkModule.dll differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs index add9b43..7ef52c7 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs @@ -19,16 +19,23 @@ namespace RJW_Menstruation AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); if (babyHARComp == null || originalHARComp == null) return; - - babyHARComp.addonVariants = new List(originalHARComp.addonVariants); - foreach (KeyValuePair> channel in originalHARComp.ColorChannels) + + foreach(KeyValuePair> channel in originalHARComp.ColorChannels) { babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second); } - babyHARComp.headVariant = originalHARComp.headVariant; - babyHARComp.bodyVariant = originalHARComp.bodyVariant; babyHARComp.headMaskVariant = originalHARComp.headMaskVariant; babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant; } + + // HAR doesn't populate variants until the graphics are called for, so this has to happen late + public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original) + { + AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); + AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); + if (babyHARComp == null || originalHARComp == null) return; + if (originalHARComp.addonVariants != null) // Testing has shown that the addons are valid by this point, but it's better to be safe + babyHARComp.addonVariants = new List(originalHARComp.addonVariants); + } } } 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 699cf02..b559221 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -244,6 +244,8 @@ namespace RJW_Menstruation CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original)); CopyBodyPartRecord(baby, original, Genital_Helper.get_uddersBPR(baby), Genital_Helper.get_uddersBPR(original)); CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original)); + if (baby.IsHAR()) + HARCompatibility.CopyHARPropertiesPostBirth(baby, original); } public override void PostBirth(Pawn mother, Pawn father, Pawn baby) @@ -409,30 +411,28 @@ namespace RJW_Menstruation { Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed); if (baby == null) break; - if (baby.genes != null && ModsConfig.BiotechActive) - { - if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype) - { - baby.genes.xenotypeName = mother.genes.xenotypeName; - baby.genes.iconDef = mother.genes.iconDef; - } - XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby); - if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef); - if (hybridBaby) - { - baby.genes.hybrid = true; - baby.genes.xenotypeName = "Hybrid".Translate(); - } - } if (division > 1) { - if (baby.IsHAR()) // necessary for HAR to decide on graphical properties pre-birth - baby.Drawer.renderer.graphics.ResolveAllGraphics(); if (i == 0) { firstbaby = baby; request.FixedGender = baby.gender; - request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); + request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList(); + if (baby.genes != null && ModsConfig.BiotechActive) + { + if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype) + { + baby.genes.xenotypeName = mother.genes.xenotypeName; + baby.genes.iconDef = mother.genes.iconDef; + } + XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby); + if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef); + if(hybridBaby) + { + baby.genes.hybrid = true; + baby.genes.xenotypeName = "Hybrid".Translate(); + } + } } else { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs index f9dc764..b1e4f91 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs @@ -110,16 +110,6 @@ namespace RJW_Menstruation } } - [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome))] - public class ApplyBirthOutcome_Patch - { - public static void PostFix(Thing birtherThing) - { - if (birtherThing is Pawn pawn && !pawn.health.Dead) - pawn.GetBreastComp()?.GaveBirth(); - } - } - [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.TryTerminatePregnancy))] public class TryTerminatePregnancy_Patch { diff --git a/changelogs.txt b/changelogs.txt index 6dc78a5..daa6265 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,5 +1,4 @@ Version 1.0.8.4 - - Fix Biotech xenotype inheritance for single-child pregnancies. - Newborns should now be baseliners if there are no xenotypes to inherit. - The Biotech terminate pregnancy recipe can now terminate a menstruation pregnancy, too. @@ -18,7 +17,7 @@ Version 1.0.8.2 Version 1.0.8.1 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead. - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes. - - Properly track Biotech pregnancy through labor. + - Properly track biotech pregnancy through labor. - Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle. - Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack. - A biotech pregnancy will pause before going into labor if another womb already is in labor.