quantum-space-buddies/QSB/ShipSync/Messages/FunnelEnableEvent.cs

27 lines
714 B
C#
Raw Normal View History

2021-06-14 15:13:32 +00:00
using QSB.Events;
using QSB.Messaging;
namespace QSB.ShipSync.Messages
2021-06-14 15:13:32 +00:00
{
2021-07-12 21:02:50 +00:00
internal class FunnelEnableEvent : QSBEvent<PlayerMessage>
2021-06-14 15:13:32 +00:00
{
public override bool RequireWorldObjectsReady => true;
2021-06-14 15:13:32 +00:00
public override void SetupListener()
=> GlobalMessenger.AddListener(EventNames.QSBEnableFunnel, Handler);
public override void CloseListener()
=> GlobalMessenger.RemoveListener(EventNames.QSBEnableFunnel, Handler);
private void Handler() => SendEvent(CreateMessage());
2021-11-20 19:49:50 +00:00
private PlayerMessage CreateMessage() => new()
2021-06-14 15:13:32 +00:00
{
AboutId = LocalPlayerId
};
2021-06-19 10:26:05 +00:00
public override void OnReceiveRemote(bool server, PlayerMessage message)
2021-06-14 15:13:32 +00:00
=> ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
}
}