26 lines
519 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
namespace QSB.TriggerSync.Messages
2022-01-12 17:02:21 -08:00
{
public class TriggerMessage : QSBWorldObjectMessage<IQSBTrigger, bool>
{
public TriggerMessage(bool entered) => Value = entered;
2022-01-12 17:02:21 -08:00
public override void OnReceiveLocal() => OnReceiveRemote();
2022-01-12 17:02:21 -08:00
public override void OnReceiveRemote()
2022-01-12 17:02:21 -08:00
{
var player = QSBPlayerManager.GetPlayer(From);
if (Value)
{
WorldObject.Enter(player);
}
else
{
WorldObject.Exit(player);
}
2022-01-12 17:02:21 -08:00
}
}
}