diff --git a/Source/Genes/Gender/GenderUtility.cs b/Source/Genes/Gender/GenderUtility.cs index 3297a0b..ea0e1d6 100644 --- a/Source/Genes/Gender/GenderUtility.cs +++ b/Source/Genes/Gender/GenderUtility.cs @@ -1,10 +1,9 @@ using Verse; using rjw; using RimWorld; +using System.Collections; using System.Linq; using System; -using System.Collections.Generic; -using HarmonyLib; namespace RJW_Genes { @@ -70,29 +69,5 @@ namespace RJW_Genes // Force Redraw at the spot pawn.Drawer.renderer.graphics.SetAllGraphicsDirty(); } - - // Fetch these once at load time because they don't change inside RJW - private static readonly List wasSexThoughts = Traverse.Create(typeof(GenderHelper)).Field("old_sex_list").GetValue>(); - private static readonly List sexChangeThoughts = Traverse.Create(typeof(GenderHelper)).Field("SexChangeThoughts").GetValue>(); - - public static void RemoveAllSexChangeThoughts(Pawn pawn) - { - // Shouldn't ever be true in the normal case, but this stops someone from calling this with an incorrect setup - if (pawn?.health == null) - return; - - if(wasSexThoughts == null || sexChangeThoughts == null || !wasSexThoughts.Any() || !sexChangeThoughts.Any()) - { - Log.Error($"Couldn't get values from RJW.\nold_sex_list: {wasSexThoughts.ToStringSafeEnumerable()}\nSexChangeThoughts: {sexChangeThoughts.ToStringSafeEnumerable()}"); - return; - } - - foreach(var def in wasSexThoughts.Concat(sexChangeThoughts)) - { - var hediff = pawn.health.hediffSet.GetFirstHediffOfDef(def); - if (hediff != null) - pawn.health.RemoveHediff(hediff); - } - } } } diff --git a/Source/Genes/Gender/Gene_FemaleOnly.cs b/Source/Genes/Gender/Gene_FemaleOnly.cs index bc8ac20..0cfbe0d 100644 --- a/Source/Genes/Gender/Gene_FemaleOnly.cs +++ b/Source/Genes/Gender/Gene_FemaleOnly.cs @@ -4,7 +4,7 @@ using rjw; namespace RJW_Genes { - public class Gene_FemaleOnly : RJW_Gene + public class Gene_FemaleOnly : Gene { public override void PostMake() { @@ -38,11 +38,5 @@ namespace RJW_Genes } } - public override void Notify_OnPawnGeneration() - { - base.Notify_OnPawnGeneration(); - // If this is Pawn generation, then we can assume that the pawn was never any gender other than female, so they shouldn't have sex change thoughts. - GenderUtility.RemoveAllSexChangeThoughts(pawn); - } } } diff --git a/Source/Genes/Gender/Gene_MaleOnly.cs b/Source/Genes/Gender/Gene_MaleOnly.cs index eba7ce5..51806cf 100644 --- a/Source/Genes/Gender/Gene_MaleOnly.cs +++ b/Source/Genes/Gender/Gene_MaleOnly.cs @@ -4,7 +4,7 @@ using rjw; namespace RJW_Genes { - public class Gene_MaleOnly : RJW_Gene + public class Gene_MaleOnly : Gene { public override void PostMake() { @@ -38,11 +38,5 @@ namespace RJW_Genes } } - public override void Notify_OnPawnGeneration() - { - base.Notify_OnPawnGeneration(); - // If this is Pawn generation, then we can assume that the pawn was never any gender other than male, so they shouldn't have sex change thoughts. - GenderUtility.RemoveAllSexChangeThoughts(pawn); - } } } diff --git a/Source/Genes/Patch_AddNotifyOnGeneration.cs b/Source/Genes/Patch_AddNotifyOnGeneration.cs deleted file mode 100644 index 3395a81..0000000 --- a/Source/Genes/Patch_AddNotifyOnGeneration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using HarmonyLib; -using System.Linq; -using Verse; - -namespace RJW_Genes.Genes -{ - [HarmonyPatch] - public static class Patch_AddNotifyOnGeneration - { - [HarmonyPatch(typeof(PawnGenerator), "GenerateGenes")] - [HarmonyPostfix] - public static void PawnGenerator_GenerateGenes_Postfix(Pawn pawn) - { - if (pawn.genes == null) return; - - foreach(var gene in pawn.genes.GenesListForReading) - { - if (gene is RJW_Gene rjwGene) - rjwGene.Notify_OnPawnGeneration(); - } - } - } -} diff --git a/Source/Genes/RJW_Gene.cs b/Source/Genes/RJW_Gene.cs index dfa05bf..d03440c 100644 --- a/Source/Genes/RJW_Gene.cs +++ b/Source/Genes/RJW_Gene.cs @@ -12,13 +12,5 @@ namespace RJW_Genes if (GenitaliaUtility.PawnStillNeedsGenitalia(pawn)) Sexualizer.sexualize_pawn(pawn); } - - /// - /// Executed via PawnGenerator.GenerateGenes at Pawn generation - /// Allows for execution of code that should only happen during PawnGeneration - /// - public virtual void Notify_OnPawnGeneration() - { - } } } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index 4343cee..6c1da44 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -133,7 +133,6 @@ -