From 9891f72fc696ccbf3db2c6616c16ac27490d4c62 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Fri, 25 Nov 2022 07:40:45 -0800 Subject: [PATCH] Poke HAR to generate parts early for enzygotic duplication --- .../Compatibility/HARCompatibility.cs | 15 +++------------ .../RJW_Menstruation/Hediff_MultiplePregnancy.cs | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) 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 d9b923b..add9b43 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs @@ -19,8 +19,9 @@ namespace RJW_Menstruation AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); if (babyHARComp == null || originalHARComp == null) return; - - foreach(KeyValuePair> channel in originalHARComp.ColorChannels) + + babyHARComp.addonVariants = new List(originalHARComp.addonVariants); + foreach (KeyValuePair> channel in originalHARComp.ColorChannels) { babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second); } @@ -29,15 +30,5 @@ namespace RJW_Menstruation 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 b559221..f57a9fd 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -244,8 +244,6 @@ 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) @@ -413,6 +411,8 @@ namespace RJW_Menstruation if (baby == null) break; 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;