mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Remove hediffs during Pawn Generation
Calls RemoveAllSexChangeThoughts via a notify method that we call after PawnGenerator creates genes
This commit is contained in:
parent
8c51c3fa59
commit
55554df7e2
5 changed files with 48 additions and 2 deletions
23
Source/Genes/Patch_AddNotifyOnGeneration.cs
Normal file
23
Source/Genes/Patch_AddNotifyOnGeneration.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue