mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# 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.
37 lines
966 B
C#
37 lines
966 B
C#
using System.Threading;
|
|
using Content.Shared.DiscordAuth;
|
|
using Robust.Client.State;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Shared.Network;
|
|
using Timer = Robust.Shared.Timing.Timer;
|
|
|
|
namespace Content.Client.DiscordAuth;
|
|
|
|
public sealed class DiscordAuthState : State
|
|
{
|
|
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;
|
|
[Dependency] private readonly IClientNetManager _net = default!;
|
|
|
|
|
|
private DiscordAuthGui? _gui;
|
|
private readonly CancellationTokenSource _checkTimerCancel = new();
|
|
|
|
|
|
protected override void Startup()
|
|
{
|
|
_gui = new DiscordAuthGui();
|
|
_userInterface.StateRoot.AddChild(_gui);
|
|
|
|
Timer.SpawnRepeating(TimeSpan.FromSeconds(5), () =>
|
|
{
|
|
_net.ClientSendMessage(new DiscordAuthCheckMessage());
|
|
}, _checkTimerCancel.Token);
|
|
}
|
|
|
|
protected override void Shutdown()
|
|
{
|
|
_checkTimerCancel.Cancel();
|
|
_gui!.Dispose();
|
|
}
|
|
}
|