quantum-space-buddies/QSB/Tools/ProbeTool/Messages/PlayerProbeEventMessage.cs
2021-12-26 22:00:43 -08:00

26 lines
567 B
C#

using QSB.Messaging;
using QSB.Player;
using QSB.WorldSync;
namespace QSB.Tools.ProbeTool.Messages
{
internal class PlayerProbeEventMessage : QSBEnumMessage<ProbeEvent>
{
public PlayerProbeEventMessage(ProbeEvent probeEvent) => Value = probeEvent;
public override bool ShouldReceive => WorldObjectManager.AllObjectsReady;
public override void OnReceiveRemote()
{
var player = QSBPlayerManager.GetPlayer(From);
if (!player.IsReady || player.Probe == null)
{
return;
}
var probe = player.Probe;
probe.HandleEvent(Value);
}
}
}