Add cvar to deadmin when joining round (#18430)

This commit is contained in:
Kevin Zheng 2023-07-31 12:13:38 -07:00 committed by GitHub
parent 2d08f02d23
commit 64e6d346d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -1,11 +1,13 @@
using System.Globalization;
using System.Linq;
using System.Numerics;
using Content.Server.Administration.Managers;
using Content.Server.Ghost;
using Content.Server.Players;
using Content.Server.Spawners.Components;
using Content.Server.Speech.Components;
using Content.Server.Station.Components;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Preferences;
@ -22,6 +24,8 @@ namespace Content.Server.GameTicking
{
public sealed partial class GameTicker
{
[Dependency] private readonly IAdminManager _adminManager = default!;
private const string ObserverPrototypeName = "MobObserver";
/// <summary>
@ -133,6 +137,10 @@ namespace Content.Server.GameTicking
return;
}
// Automatically de-admin players who are joining.
if (_cfg.GetCVar(CCVars.AdminDeadminOnJoin) && _adminManager.IsAdmin(player))
_adminManager.DeAdmin(player);
// We raise this event to allow other systems to handle spawning this player themselves. (e.g. late-join wizard, etc)
var bev = new PlayerBeforeSpawnEvent(player, character, jobId, lateJoin, station);
RaiseLocalEvent(bev);

View File

@ -705,6 +705,13 @@ namespace Content.Shared.CCVar
public static readonly CVarDef<bool> AdminShowPIIOnBan =
CVarDef.Create("admin.show_pii_onban", false, CVar.SERVERONLY);
/// <summary>
/// If an admin joins a round by reading up or using the late join button, automatically
/// de-admin them.
/// </summary>
public static readonly CVarDef<bool> AdminDeadminOnJoin =
CVarDef.Create("admin.deadmin_on_join", false, CVar.SERVERONLY);
/*
* Explosions
*/