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