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
|
|
|
|
|
2023-05-08 11:30:59 -07:00
|
|
|
|
namespace QSB.OwnershipSync;
|
2022-03-02 19:46:33 -08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// always sent to host
|
|
|
|
|
/// </summary>
|
2023-05-08 11:30:59 -07:00
|
|
|
|
public class OwnQueueMessage : QSBMessage<(uint NetId, OwnQueueAction Action)>
|
2022-02-24 22:04:54 -08:00
|
|
|
|
{
|
2023-05-08 11:30:59 -07:00
|
|
|
|
public OwnQueueMessage(uint netId, OwnQueueAction 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();
|
2023-05-08 11:38:24 -07:00
|
|
|
|
public override void OnReceiveRemote() => NetworkServer.spawned[Data.NetId].ServerUpdateOwnQueue(From, Data.Action);
|
2022-03-02 19:41:33 -08:00
|
|
|
|
}
|
2022-03-02 19:46:33 -08:00
|
|
|
|
|
2023-05-08 11:30:59 -07:00
|
|
|
|
public enum OwnQueueAction
|
2022-03-02 19:46:33 -08:00
|
|
|
|
{
|
|
|
|
|
/// <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
|
|
|
|
|
}
|