Remove hediffs during Pawn Generation

Calls RemoveAllSexChangeThoughts via a notify method that we call after PawnGenerator creates genes
This commit is contained in:
callavico 2023-04-26 20:56:55 -04:00
parent 8c51c3fa59
commit 55554df7e2
5 changed files with 48 additions and 2 deletions

View file

@ -4,7 +4,7 @@ using rjw;
namespace RJW_Genes
{
public class Gene_FemaleOnly : Gene
public class Gene_FemaleOnly : RJW_Gene
{
public override void PostMake()
{
@ -24,6 +24,8 @@ namespace RJW_Genes
private void AdjustPawnToFemale()
{
Log.Message($"Gene_FemaleOnly AdjustPawnToFemale | {pawn} | {pawn.gender}");
// Here we really use the Gender.Female and not our helper IsFemale(pawn)
if (pawn.gender == Gender.Female)
return;
@ -38,5 +40,11 @@ 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);
}
}
}

View file

@ -4,7 +4,7 @@ using rjw;
namespace RJW_Genes
{
public class Gene_MaleOnly : Gene
public class Gene_MaleOnly : RJW_Gene
{
public override void PostMake()
{
@ -38,5 +38,11 @@ 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);
}
}
}