using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
using QSB.Messaging;
using System.Linq;
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
///
/// always sent by host
///
internal class IlluminatedByMessage : QSBWorldObjectMessage
{
public IlluminatedByMessage(uint[] illuminatedBy) : base(illuminatedBy) { }
public override void OnReceiveRemote()
{
foreach (var added in Data.Except(WorldObject._illuminatedBy))
{
WorldObject.SetIlluminated(added, true);
}
foreach (var removed in WorldObject._illuminatedBy.Except(Data))
{
WorldObject.SetIlluminated(removed, false);
}
}
}