mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-06 01:00:16 +00:00
check if local player exists before sending
This commit is contained in:
parent
ee0de74c69
commit
a0655b67eb
@ -1,14 +1,22 @@
|
||||
using QSB.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EyeOfTheUniverse.EyeStateSync.Events
|
||||
{
|
||||
internal class EyeStateMessage : QSBEnumMessage<EyeState>
|
||||
{
|
||||
static EyeStateMessage() => GlobalMessenger<EyeState>.AddListener(EventNames.EyeStateChanged,
|
||||
state => new EyeStateMessage(state).Send());
|
||||
static EyeStateMessage() => GlobalMessenger<EyeState>.AddListener(EventNames.EyeStateChanged, Handler);
|
||||
|
||||
private static void Handler(EyeState state)
|
||||
{
|
||||
if (PlayerTransformSync.LocalInstance != null)
|
||||
{
|
||||
new EyeStateMessage(state).Send();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public EyeStateMessage(EyeState state) => Value = state;
|
||||
|
Loading…
Reference in New Issue
Block a user