Add a CCVar to allow from hiding admins in the reported player count. (#34406)
Good for: - Keeping admins hidden - Not confuse players seeing 84/80 players Nicely pairs up with the ``admin.admins_count_for_max_players`` ccvar
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Text.Json.Nodes;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.GameTicking;
|
||||
@@ -43,7 +44,9 @@ namespace Content.Server.GameTicking
|
||||
jObject["name"] = _baseServer.ServerName;
|
||||
jObject["map"] = _gameMapManager.GetSelectedMap()?.MapName;
|
||||
jObject["round_id"] = _gameTicker.RoundId;
|
||||
jObject["players"] = _playerManager.PlayerCount;
|
||||
jObject["players"] = _cfg.GetCVar(CCVars.AdminsCountInReportedPlayerCount)
|
||||
? _playerManager.PlayerCount
|
||||
: _playerManager.PlayerCount - _adminManager.ActiveAdmins.Count();
|
||||
jObject["soft_max_players"] = _cfg.GetCVar(CCVars.SoftMaxPlayers);
|
||||
jObject["panic_bunker"] = _cfg.GetCVar(CCVars.PanicBunkerEnabled);
|
||||
jObject["run_level"] = (int) _runLevel;
|
||||
|
||||
@@ -158,6 +158,13 @@ public sealed partial class CCVars
|
||||
public static readonly CVarDef<bool> AdminsCountForMaxPlayers =
|
||||
CVarDef.Create("admin.admins_count_for_max_players", false, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Should admins be hidden from the player count reported to the launcher/via api?
|
||||
/// This is hub advert safe, in case that's a worry.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> AdminsCountInReportedPlayerCount =
|
||||
CVarDef.Create("admin.admins_count_in_playercount", false, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Determine if custom rank names are used.
|
||||
/// If it is false, it'd use the actual rank name regardless of the individual's title.
|
||||
|
||||
Reference in New Issue
Block a user