diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index 19fe770..3cf61fc 100644 Binary files a/1.3/Assemblies/RJW_Menstruation.dll and b/1.3/Assemblies/RJW_Menstruation.dll differ diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 3120c5a..319f64a 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -249,8 +249,8 @@ namespace RJW_Menstruation public RJW_Menstruation(ModContentPack content) : base(content) { GetSettings(); - Configurations.HARActivated = ModLister.HasActiveModWithName("Humanoid Alien Races 2.0"); - Configurations.LLActivated = ModLister.HasActiveModWithName("RimJobWorld - Licentia Labs"); + Configurations.HARActivated = ModLister.GetActiveModWithIdentifier("erdelf.HumanoidAlienRaces") != null; + Configurations.LLActivated = ModLister.GetActiveModWithIdentifier("LustLicentia.RJWLabs") != null; } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs index c274d8d..863eaa4 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs @@ -1,4 +1,6 @@ -using System.Linq; +using AlienRace; +using System.Collections.Generic; +using UnityEngine; using Verse; namespace RJW_Menstruation @@ -8,24 +10,38 @@ namespace RJW_Menstruation public static bool IsHAR(this Pawn pawn) { - return pawn.def.GetType().ToString().StartsWith("AlienRace"); + if (!Configurations.HARActivated) return false; + return pawn?.def is ThingDef_AlienRace; } - public static ThingComp GetHARComp(this Pawn pawn) + public static AlienPartGenerator.AlienComp GetHARComp(this Pawn pawn) { - return pawn?.GetComps()?.First(x => x.GetType().Namespace.EqualsIgnoreCase("AlienRace") && x.GetType().Name.EndsWith("AlienComp")); + return pawn?.TryGetComp(); } - public static string GetHARCrown(this Pawn pawn) + public static void CopyHARProperties(Pawn baby, Pawn original) { - return (string)pawn.GetHARComp().GetMemberValue("crownType"); + AlienPartGenerator.AlienComp babyHARComp = baby.GetHARComp(); + AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp(); + if (babyHARComp == null || originalHARComp == null) return; + babyHARComp.crownType = originalHARComp.crownType; + + foreach(KeyValuePair> channel in originalHARComp.ColorChannels) + { + babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second); + } + babyHARComp.headMaskVariant = originalHARComp.headMaskVariant; + babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant; } - public static void SetHARCrown(this Pawn pawn, string crown) + // 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) { - pawn.GetHARComp().SetMemberValue("crownType", crown); + AlienPartGenerator.AlienComp babyHARComp = baby.GetHARComp(); + AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp(); + 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.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index c1cdcac..cb72810 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -238,6 +238,8 @@ namespace RJW_Menstruation CopyBodyPartRecord(baby, original, Genital_Helper.get_genitalsBPR(baby), Genital_Helper.get_genitalsBPR(original)); CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(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) @@ -417,7 +419,6 @@ namespace RJW_Menstruation int division = 1; Pawn firstbaby = null; string firstheadpath = null; - string firstHARcrown = null; int traitSeed = Rand.Int; List parentTraits = GetInheritableTraits(mother, father); while (Rand.Chance(Configurations.EnzygoticTwinsChance) && division < Configurations.MaxEnzygoticTwins) division++; @@ -442,10 +443,6 @@ namespace RJW_Menstruation if (head != null) baby.story.SetMemberValue("headGraphicPath", head.GraphicPath); firstheadpath = (string)baby.story.GetMemberValue("headGraphicPath"); } - if (Configurations.HARActivated && baby.IsHAR()) - { - firstHARcrown = baby.GetHARCrown(); - } } else @@ -456,9 +453,9 @@ namespace RJW_Menstruation baby.story.crownType = firstbaby.story.crownType; baby.story.SetMemberValue("headGraphicPath", firstheadpath); - if (Configurations.HARActivated && baby.IsHAR()) + if (baby.IsHAR()) { - baby.SetHARCrown(firstHARcrown); + HARCompatibility.CopyHARProperties(baby, firstbaby); } } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 2cab59f..f73a2ef 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -89,6 +89,10 @@ + + ..\..\..\..\..\..\..\..\workshop\content\294100\839005762\1.3\Assemblies\AlienRace.dll + False + ..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll False diff --git a/About/About.xml b/About/About.xml index 426bf26..4dbf4bb 100644 --- a/About/About.xml +++ b/About/About.xml @@ -21,6 +21,7 @@
  • brrainz.harmony
  • +
  • erdelf.HumanoidAlienRaces
  • rim.job.world
  • Abraxas.RJW.RaceSupport
  • rjw.milk.humanoid
  • diff --git a/changelogs.txt b/changelogs.txt index d600e9b..afc00c4 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,9 +1,10 @@ Version 1.0.7.1 - Null reference error fix for multiple wombs when one is pregnant. - Nipple size/transition system rewritten to be simpler under the hood. Should work with existing saves, but you might find sizes to be different, especially for very large or very small breasts. - - Identical twins conceived after this update will have identical sex part sizes, properties, etc. upon being born. - Replaced HugsLib-based scheduler with normal ticking. This should reduce some 'phantom cycle' bugs. - Redone calculation to determine low eggs remaining. This should cause climacteric to be applied at a more appropriate time in the pawn's life, especially for those with very long cycles. + - Identical twins conceived after this update will have identical sex part sizes, properties, etc. upon being born. + - Identical twins of HAR races will have identical coloration, part variations, and masking. - For modders: - The function Hediff_MultiplePregnancy.ProcessIdenticalSibling is called on every identical sibling when born except the first. Any race-specfic genetic properties can be patched in there. - Any mods that add comps to RJW parts should copy what they need to on a postfix to Hediff_MultiplePregnancy.CopyBodyPartProperties, e.g. how menstruation itself does in that function.