25 lines
499 B
C#
Raw Normal View History

2022-01-12 17:02:21 -08:00
using QSB.Messaging;
using QSB.Player;
2022-01-12 19:18:59 -08:00
using QSB.TriggerSync.WorldObjects;
2022-01-12 17:02:21 -08:00
2022-03-02 19:46:33 -08:00
namespace QSB.TriggerSync.Messages;
public class TriggerMessage : QSBWorldObjectMessage<IQSBTrigger, bool>
2022-01-12 17:02:21 -08:00
{
2022-03-10 17:57:50 -08:00
public TriggerMessage(bool entered) : base(entered) { }
2022-01-12 17:02:21 -08:00
2022-03-02 19:46:33 -08:00
public override void OnReceiveLocal() => OnReceiveRemote();
2022-01-12 17:02:21 -08:00
2022-03-02 19:46:33 -08:00
public override void OnReceiveRemote()
{
var player = QSBPlayerManager.GetPlayer(From);
if (Data)
{
WorldObject.Enter(player);
}
else
2022-01-12 17:02:21 -08:00
{
2022-03-02 19:46:33 -08:00
WorldObject.Exit(player);
2022-01-12 17:02:21 -08:00
}
}
}