Improved some Documentation, closes #32

This commit is contained in:
Vegapnk 2023-04-30 10:06:53 +02:00
parent c039ae1e3b
commit 4c738e3035
4 changed files with 12 additions and 3 deletions

View File

@ -75,6 +75,13 @@ namespace RJW_Genes
private static readonly List<HediffDef> wasSexThoughts = Traverse.Create(typeof(GenderHelper)).Field("old_sex_list").GetValue<List<HediffDef>>();
private static readonly List<HediffDef> sexChangeThoughts = Traverse.Create(typeof(GenderHelper)).Field("SexChangeThoughts").GetValue<List<HediffDef>>();
/// <summary>
/// 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.
/// </summary>
/// <param name="pawn">The pawn that needs to have SexChange-Thoughts removed.</param>
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;
}

View File

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

View File

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

View File

@ -16,6 +16,8 @@ namespace RJW_Genes
/// <summary>
/// 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`.
/// </summary>
public virtual void Notify_OnPawnGeneration()
{