2022-01-13 23:38:45 -08:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.Messaging;
|
2021-12-22 01:16:44 -08:00
|
|
|
|
using QSB.WorldSync;
|
2021-11-30 16:57:04 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
namespace QSB.AuthoritySync;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// always sent to host
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class AuthQueueMessage : QSBMessage<(uint NetId, AuthQueueAction Action)>
|
2022-02-24 22:04:54 -08:00
|
|
|
|
{
|
2022-03-10 17:57:50 -08:00
|
|
|
|
public AuthQueueMessage(uint netId, AuthQueueAction action) : base((netId, action)) =>
|
2022-03-02 19:46:33 -08:00
|
|
|
|
To = 0;
|
2021-12-17 20:11:38 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08: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-02 19:41:33 -08:00
|
|
|
|
}
|
2022-03-02 19:46:33 -08: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
|
|
|
|
|
}
|