Poke HAR to generate parts early for enzygotic duplication

This commit is contained in:
lutepickle 2022-11-25 07:40:45 -08:00
parent 08d84801a6
commit 9891f72fc6
2 changed files with 5 additions and 14 deletions

View file

@ -19,8 +19,9 @@ namespace RJW_Menstruation
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
if (babyHARComp == null || originalHARComp == null) return;
foreach(KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
foreach (KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> 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>();
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
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<int>(originalHARComp.addonVariants);
}
}
}

View file

@ -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;