mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-16 07:10:35 +00:00
29 lines
842 B
C#
29 lines
842 B
C#
using QSB.Messaging;
|
|
using QSB.Player;
|
|
using System.Linq;
|
|
|
|
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
|
|
|
|
/// <summary>
|
|
/// always sent by host
|
|
/// </summary>
|
|
internal class PlayerIlluminatedByMessage : QSBMessage<(uint playerId, uint[] illuminatedBy)>
|
|
{
|
|
public PlayerIlluminatedByMessage(uint playerId, uint[] illuminatedBy) : base((playerId, illuminatedBy)) { }
|
|
|
|
public override void OnReceiveRemote()
|
|
{
|
|
var qsbPlayerLightSensor = QSBPlayerManager.GetPlayer(Data.playerId).QSBPlayerLightSensor;
|
|
|
|
foreach (var added in Data.illuminatedBy.Except(qsbPlayerLightSensor._illuminatedBy).ToList())
|
|
{
|
|
qsbPlayerLightSensor.SetIlluminated(added, true);
|
|
}
|
|
|
|
foreach (var removed in qsbPlayerLightSensor._illuminatedBy.Except(Data.illuminatedBy).ToList())
|
|
{
|
|
qsbPlayerLightSensor.SetIlluminated(removed, false);
|
|
}
|
|
}
|
|
}
|