Add an exception to the soft max player cap for players who joined the game at some point during the current round. (#6245)

This commit is contained in:
Moony
2022-01-19 17:01:21 -06:00
committed by GitHub
parent 044635c10b
commit 1a62cefdf9
5 changed files with 14 additions and 5 deletions

View File

@@ -1,13 +1,13 @@
using System;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Content.Server.Administration.Managers;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Server.Preferences.Managers;
using Content.Shared;
using Content.Shared.CCVar;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Network;
@@ -76,9 +76,10 @@ The ban reason is: ""{ban.Reason}""
}
var adminData = await _dbManager.GetAdminDataForAsync(e.UserId);
if (_plyMgr.PlayerCount >= _cfg.GetCVar(CCVars.SoftMaxPlayers) && adminData is null)
var wasInGame = EntitySystem.TryGet<GameTicker>(out var ticker) && ticker.PlayersInGame.Contains(userId);
if ((_plyMgr.PlayerCount >= _cfg.GetCVar(CCVars.SoftMaxPlayers) && adminData is null) && !wasInGame )
{
e.Deny("The server is full!");
e.Deny(Loc.GetString("soft-player-cap-full"));
return;
}