Do the concealed hediff removal in two stages to avoid a collection modification error

This commit is contained in:
lutepickle 2022-09-05 21:35:11 -07:00
parent 16c0362dc2
commit c3ce69ac0a
2 changed files with 4 additions and 1 deletions

View File

@ -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<Hediff> removals = pawn.health.hediffSet.hediffs.Where(hediff => hediff.def == VariousDefOf.Hediff_Estrus_Concealed).ToList();
foreach (Hediff concealedEstrus in removals)
{
pawn.health.RemoveHediff(concealedEstrus);
}

View File

@ -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