mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 19:11:32 +00:00
24 lines
755 B
C#
24 lines
755 B
C#
using QSB.Events;
|
|
using QSB.Messaging;
|
|
|
|
namespace QSB.SaveSync.Events
|
|
{
|
|
internal class RequestGameStateEvent : QSBEvent<PlayerMessage>
|
|
{
|
|
public override bool RequireWorldObjectsReady => false;
|
|
|
|
public override void SetupListener() => GlobalMessenger.AddListener(EventNames.QSBRequestGameDetails, Handler);
|
|
public override void CloseListener() => GlobalMessenger.RemoveListener(EventNames.QSBRequestGameDetails, Handler);
|
|
|
|
private void Handler() => SendEvent(CreateMessage());
|
|
|
|
private PlayerMessage CreateMessage() => new()
|
|
{
|
|
AboutId = LocalPlayerId,
|
|
OnlySendToHost = true
|
|
};
|
|
|
|
public override void OnReceiveRemote(bool isHost, PlayerMessage message) => QSBEventManager.FireEvent(EventNames.QSBGameDetails, message.FromId);
|
|
}
|
|
}
|