rjw-genes/Source/Genes/Patch_AddNotifyOnGeneration.cs
callavico 55554df7e2 Remove hediffs during Pawn Generation
Calls RemoveAllSexChangeThoughts via a notify method that we call after PawnGenerator creates genes
2023-04-26 20:56:55 -04:00

23 lines
587 B
C#

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