Revert "Revert "LightSensorIlluminatedMessage""

This reverts commit 283bf05887.
This commit is contained in:
JohnCorby 2022-05-27 15:11:02 -07:00
parent 0a88acd64c
commit d64ab99d8c

View File

@ -0,0 +1,27 @@
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
using QSB.Messaging;
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
internal class LightSensorIlluminatedMessage : QSBWorldObjectMessage<QSBLightSensor, bool>
{
public LightSensorIlluminatedMessage(bool illuminated) : base(illuminated) { }
public override void OnReceiveRemote()
{
if (WorldObject.AttachedObject._illuminated == Data)
{
return;
}
WorldObject.AttachedObject._illuminated = Data;
if (Data)
{
WorldObject.AttachedObject.OnDetectLight.Invoke();
}
else
{
WorldObject.AttachedObject.OnDetectDarkness.Invoke();
}
}
}