From 4c738e30359ceb0f83d934aa5d84fdb71c01cb1b Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sun, 30 Apr 2023 10:06:53 +0200 Subject: [PATCH] Improved some Documentation, closes #32 --- Source/Genes/Gender/GenderUtility.cs | 9 ++++++++- Source/Genes/Gender/Gene_FemaleOnly.cs | 2 +- Source/Genes/Gender/Gene_MaleOnly.cs | 2 +- Source/Genes/RJW_Gene.cs | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/Genes/Gender/GenderUtility.cs b/Source/Genes/Gender/GenderUtility.cs index 3297a0b..10b811d 100644 --- a/Source/Genes/Gender/GenderUtility.cs +++ b/Source/Genes/Gender/GenderUtility.cs @@ -75,6 +75,13 @@ namespace RJW_Genes 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>(); + /// + /// This method removes all RJW-Sexchange-Hediffs from the pawn. + /// It used with the RJW_Gene.Notify_OnPawnGeneration() to check for pawns on spawn. + /// + /// Fixes Issue #32, where pawns that spawn fresh with a "all female" gene may have m2f thoughts. + /// + /// The pawn that needs to have SexChange-Thoughts removed. 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 @@ -83,7 +90,7 @@ namespace RJW_Genes 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()}"); + Log.Warning($"Couldn't get values from RJW.\nold_sex_list: {wasSexThoughts.ToStringSafeEnumerable()}\nSexChangeThoughts: {sexChangeThoughts.ToStringSafeEnumerable()}"); return; } diff --git a/Source/Genes/Gender/Gene_FemaleOnly.cs b/Source/Genes/Gender/Gene_FemaleOnly.cs index bc8ac20..97c4365 100644 --- a/Source/Genes/Gender/Gene_FemaleOnly.cs +++ b/Source/Genes/Gender/Gene_FemaleOnly.cs @@ -41,7 +41,7 @@ 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. + // 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. (Issue #32) GenderUtility.RemoveAllSexChangeThoughts(pawn); } } diff --git a/Source/Genes/Gender/Gene_MaleOnly.cs b/Source/Genes/Gender/Gene_MaleOnly.cs index eba7ce5..e081700 100644 --- a/Source/Genes/Gender/Gene_MaleOnly.cs +++ b/Source/Genes/Gender/Gene_MaleOnly.cs @@ -41,7 +41,7 @@ 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. + // 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. (Issue #32) GenderUtility.RemoveAllSexChangeThoughts(pawn); } } diff --git a/Source/Genes/RJW_Gene.cs b/Source/Genes/RJW_Gene.cs index dfa05bf..c006d2c 100644 --- a/Source/Genes/RJW_Gene.cs +++ b/Source/Genes/RJW_Gene.cs @@ -16,6 +16,8 @@ namespace RJW_Genes /// /// Executed via PawnGenerator.GenerateGenes at Pawn generation /// Allows for execution of code that should only happen during PawnGeneration + /// + /// This has an accompanying patch `Patch_AddNotifyOnGeneration.cs`. /// public virtual void Notify_OnPawnGeneration() {