copy list since its modified

This commit is contained in:
JohnCorby 2022-07-24 11:24:42 -07:00
parent 540473d4e6
commit b1810c413e
2 changed files with 4 additions and 4 deletions

View File

@ -13,12 +13,12 @@ internal class IlluminatedByMessage : QSBWorldObjectMessage<QSBLightSensor, uint
public override void OnReceiveRemote()
{
foreach (var added in Data.Except(WorldObject._illuminatedBy))
foreach (var added in Data.Except(WorldObject._illuminatedBy).ToList())
{
WorldObject.SetIlluminated(added, true);
}
foreach (var removed in WorldObject._illuminatedBy.Except(Data))
foreach (var removed in WorldObject._illuminatedBy.Except(Data).ToList())
{
WorldObject.SetIlluminated(removed, false);
}

View File

@ -15,12 +15,12 @@ internal class PlayerIlluminatedByMessage : QSBMessage<(uint playerId, uint[] il
{
var qsbPlayerLightSensor = QSBPlayerManager.GetPlayer(Data.playerId).QSBPlayerLightSensor;
foreach (var added in Data.illuminatedBy.Except(qsbPlayerLightSensor._illuminatedBy))
foreach (var added in Data.illuminatedBy.Except(qsbPlayerLightSensor._illuminatedBy).ToList())
{
qsbPlayerLightSensor.SetIlluminated(added, true);
}
foreach (var removed in qsbPlayerLightSensor._illuminatedBy.Except(Data.illuminatedBy))
foreach (var removed in qsbPlayerLightSensor._illuminatedBy.Except(Data.illuminatedBy).ToList())
{
qsbPlayerLightSensor.SetIlluminated(removed, false);
}