mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-10 15:53:19 +00:00
26 lines
689 B
C#
26 lines
689 B
C#
using QSB.Messaging;
|
|
using QSB.TransformSync;
|
|
|
|
namespace QSB.Events
|
|
{
|
|
public class PlayerStatesRequestEvent : QSBEvent<PlayerMessage>
|
|
{
|
|
public override MessageType Type => MessageType.FullStateRequest;
|
|
|
|
public override void SetupListener()
|
|
{
|
|
GlobalMessenger.AddListener("QSBPlayerStatesRequest", () => SendEvent(CreateMessage()));
|
|
}
|
|
|
|
private PlayerMessage CreateMessage() => new PlayerMessage
|
|
{
|
|
SenderId = PlayerTransformSync.LocalInstance.netId.Value
|
|
};
|
|
|
|
public override void OnServerReceive(PlayerMessage message)
|
|
{
|
|
PlayerState.LocalInstance.Send();
|
|
}
|
|
}
|
|
}
|