quantum-space-buddies/QSB/ShipSync/Events/FunnelEnableEvent.cs
Mister_Nebula ae8bf9a8b2 aaaaaaaaaa
2021-11-20 19:49:50 +00:00

27 lines
715 B
C#

using QSB.Events;
using QSB.Messaging;
namespace QSB.ShipSync.Events
{
internal class FunnelEnableEvent : QSBEvent<PlayerMessage>
{
public override EventType Type => EventType.EnableFunnel;
public override void SetupListener()
=> GlobalMessenger.AddListener(EventNames.QSBEnableFunnel, Handler);
public override void CloseListener()
=> GlobalMessenger.RemoveListener(EventNames.QSBEnableFunnel, Handler);
private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new()
{
AboutId = LocalPlayerId
};
public override void OnReceiveRemote(bool server, PlayerMessage message)
=> ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
}
}