Files
wwdpublic/Content.Shared/JoinQueue/QueueUpdateMessage.cs
DEATHB4DEFEAT d4663e9993 Port Queue and Discord Auth From Corvax (#355)
# Description

I didn't make 2 PRs because the queue kinda depends on Discord auth and
I didn't wanna spend the time splitting them up.

The queue puts everyone except admins/whitelisted/previously in-game
players into a queue after the soft max players is reached, hard cap
still denies new connections (and queues) from everyone.
Priority queuing is simple to add and I'll do that when I make donator
benefits or whatever similar system.

---

<details><summary><h1>Media</h1></summary>
<p>

Too big to embed and I don't wanna compress it :)

https://youtu.be/NBqN6Piv94w

</p>
</details>

---

# Changelog

🆑
- add: Added a queue for players so you don't need to spam reconnect and
hope you join when someone leaves.
2024-05-13 00:58:39 -04:00

37 lines
979 B
C#

using Lidgren.Network;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.JoinQueue;
/// <summary>
/// Sent from server to client with queue state for player
/// Also initiates queue state on client
/// </summary>
public sealed class QueueUpdateMessage : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.Command;
/// <summary>
/// Total players in queue
/// </summary>
public int Total { get; set; }
/// <summary>
/// Player current position in queue (starts from 1)
/// </summary>
public int Position { get; set; }
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
{
Total = buffer.ReadInt32();
Position = buffer.ReadInt32();
}
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
{
buffer.Write(Total);
buffer.Write(Position);
}
}