Don't call Notify_UpdatedGenes if the gene isn't menstruation-related

This commit is contained in:
lutepickle 2024-02-27 14:58:20 -08:00
parent 32800a3499
commit 7e407a1cf9
1 changed files with 2 additions and 1 deletions

View File

@ -195,8 +195,9 @@ namespace RJW_Menstruation
[HarmonyPatch(typeof(Pawn_GeneTracker), "Notify_GenesChanged")] [HarmonyPatch(typeof(Pawn_GeneTracker), "Notify_GenesChanged")]
public class Notify_GenesChanged_Patch public class Notify_GenesChanged_Patch
{ {
public static void Postfix(Pawn_GeneTracker __instance) public static void Postfix(Pawn_GeneTracker __instance, GeneDef addedOrRemovedGene)
{ {
if (!addedOrRemovedGene.HasModExtension<MenstruationModExtension>()) return;
foreach (HediffComp_Menstruation comp in __instance.pawn.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in __instance.pawn.GetMenstruationComps())
comp.Notify_UpdatedGenes(); comp.Notify_UpdatedGenes();
} }