2022-05-28 09:58:19 -07:00
|
|
|
|
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// always sent by host
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal class IlluminatedByMessage : QSBWorldObjectMessage<QSBLightSensor, uint[]>
|
|
|
|
|
{
|
|
|
|
|
public IlluminatedByMessage(uint[] illuminatedBy) : base(illuminatedBy) { }
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
2022-08-02 21:15:06 -07:00
|
|
|
|
foreach (var added in Data.Except(WorldObject._illuminatedBy).ToList())
|
2022-05-28 09:58:19 -07:00
|
|
|
|
{
|
|
|
|
|
WorldObject.SetIlluminated(added, true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-02 21:15:06 -07:00
|
|
|
|
foreach (var removed in WorldObject._illuminatedBy.Except(Data).ToList())
|
2022-05-28 09:58:19 -07:00
|
|
|
|
{
|
|
|
|
|
WorldObject.SetIlluminated(removed, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|