quantum-space-buddies/QSB/TriggerSync/Messages/TriggerMessage.cs

25 lines
499 B
C#
Raw Normal View History

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