From c3ce69ac0afd3bcffa7597de600161ad702efc9c Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Mon, 5 Sep 2022 21:35:11 -0700 Subject: [PATCH] Do the concealed hediff removal in two stages to avoid a collection modification error --- 1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs | 4 +++- changelogs.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs index 73c44f6..297507e 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs @@ -1,4 +1,5 @@ using RimWorld; +using System.Collections.Generic; using System.Linq; using Verse; @@ -30,7 +31,8 @@ namespace RJW_Menstruation base.PostAdd(dinfo); if (IsVisible) { - foreach (Hediff concealedEstrus in pawn.health.hediffSet.hediffs.Where(hediff => hediff.def == VariousDefOf.Hediff_Estrus_Concealed)) + List removals = pawn.health.hediffSet.hediffs.Where(hediff => hediff.def == VariousDefOf.Hediff_Estrus_Concealed).ToList(); + foreach (Hediff concealedEstrus in removals) { pawn.health.RemoveHediff(concealedEstrus); } diff --git a/changelogs.txt b/changelogs.txt index 5c8a93d..3dd9cb5 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,4 +1,5 @@ Version 1.0.7.5 + - Fix error when one womb's concealed estrus is overwritten by another womb's visible estrus. - Climacteric and menopause are now per-womb. Their effect on overall sex drive and satisfaction will depend on the health of any other wombs. Version 1.0.7.4