2022-02-25 23:18:46 -08:00

25 lines
500 B
C#

using QSB.Messaging;
using QSB.Player;
using QSB.TriggerSync.WorldObjects;
namespace QSB.TriggerSync.Messages;
public class TriggerMessage : QSBWorldObjectMessage<IQSBTrigger, bool>
{
public TriggerMessage(bool entered) => Value = entered;
public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote()
{
var player = QSBPlayerManager.GetPlayer(From);
if (Value)
{
WorldObject.Enter(player);
}
else
{
WorldObject.Exit(player);
}
}
}