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 RimWorld;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Verse; using Verse;
@ -30,7 +31,8 @@ namespace RJW_Menstruation
base.PostAdd(dinfo); base.PostAdd(dinfo);
if (IsVisible) 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); pawn.health.RemoveHediff(concealedEstrus);
} }

View file

@ -1,4 +1,5 @@
Version 1.0.7.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. - 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 Version 1.0.7.4