mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Fixed exception when pawn uses a bucket
This commit is contained in:
parent
811162875d
commit
2c225a2d41
2 changed files with 17 additions and 7 deletions
|
@ -145,14 +145,15 @@ namespace RJWSexperience.Cum
|
|||
if (!sexFillsCumbuckets)
|
||||
return;
|
||||
|
||||
IEnumerable<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>();
|
||||
// Enumerable throws System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
|
||||
List<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>().ToList();
|
||||
|
||||
if (buckets?.EnumerableCount() > 0)
|
||||
if (buckets?.Count > 0)
|
||||
{
|
||||
var initialCum = CumUtility.GetCumVolume(props.pawn);
|
||||
var initialCum = GetCumVolume(props.pawn);
|
||||
foreach (Building_CumBucket bucket in buckets)
|
||||
{
|
||||
bucket.AddCum(initialCum / buckets.EnumerableCount());
|
||||
bucket.AddCum(initialCum / buckets.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue