2022-01-14 07:38:45 +00:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.Messaging;
|
2021-12-22 09:16:44 +00:00
|
|
|
|
using QSB.WorldSync;
|
2021-12-01 00:57:04 +00:00
|
|
|
|
|
2023-05-08 18:30:59 +00:00
|
|
|
|
namespace QSB.OwnershipSync;
|
2022-03-03 03:46:33 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// always sent to host
|
|
|
|
|
/// </summary>
|
2023-05-08 18:41:43 +00:00
|
|
|
|
public class OwnerQueueMessage : QSBMessage<(uint NetId, OwnerQueueAction Action)>
|
2022-02-25 06:04:54 +00:00
|
|
|
|
{
|
2023-05-08 18:41:43 +00:00
|
|
|
|
public OwnerQueueMessage(uint netId, OwnerQueueAction 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();
|
2023-05-08 18:41:43 +00:00
|
|
|
|
public override void OnReceiveRemote() => NetworkServer.spawned[Data.NetId].ServerUpdateOwnerQueue(From, Data.Action);
|
2022-03-03 03:41:33 +00:00
|
|
|
|
}
|
2022-03-03 03:46:33 +00:00
|
|
|
|
|
2023-05-08 18:41:43 +00:00
|
|
|
|
public enum OwnerQueueAction
|
2022-03-03 03:46:33 +00: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
|
|
|
|
|
}
|