quantum-space-buddies/QSB/AuthoritySync/AuthQueueMessage.cs

34 lines
843 B
C#
Raw Normal View History

using Mirror;
using QSB.Messaging;
2021-12-22 09:16:44 +00:00
using QSB.WorldSync;
2021-12-01 00:57:04 +00:00
2022-03-03 03:46:33 +00:00
namespace QSB.AuthoritySync;
/// <summary>
/// always sent to host
/// </summary>
public class AuthQueueMessage : QSBMessage<(uint NetId, AuthQueueAction Action)>
{
2022-03-11 01:57:50 +00:00
public AuthQueueMessage(uint netId, AuthQueueAction action) : base((netId, action)) =>
2022-03-03 03:46:33 +00:00
To = 0;
2021-12-18 04:11:38 +00:00
2022-03-03 03:46:33 +00:00
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote() => NetworkServer.spawned[Data.NetId].ServerUpdateAuthQueue(From, Data.Action);
}
2022-03-03 03:46:33 +00:00
public enum AuthQueueAction
{
/// <summary>
/// add player to the queue
/// </summary>
Add,
/// <summary>
/// remove player from the queue
/// </summary>
Remove,
/// <summary>
/// add player to the queue and force them to the front
/// </summary>
Force
}