Add cvar to deadmin when joining round (#18430)
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Content.Server.Administration.Managers;
|
||||||
using Content.Server.Ghost;
|
using Content.Server.Ghost;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
using Content.Server.Speech.Components;
|
using Content.Server.Speech.Components;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
@@ -22,6 +24,8 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
public sealed partial class GameTicker
|
public sealed partial class GameTicker
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IAdminManager _adminManager = default!;
|
||||||
|
|
||||||
private const string ObserverPrototypeName = "MobObserver";
|
private const string ObserverPrototypeName = "MobObserver";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -133,6 +137,10 @@ namespace Content.Server.GameTicking
|
|||||||
return;
|
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)
|
// 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);
|
var bev = new PlayerBeforeSpawnEvent(player, character, jobId, lateJoin, station);
|
||||||
RaiseLocalEvent(bev);
|
RaiseLocalEvent(bev);
|
||||||
|
|||||||
@@ -705,6 +705,13 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<bool> AdminShowPIIOnBan =
|
public static readonly CVarDef<bool> AdminShowPIIOnBan =
|
||||||
CVarDef.Create("admin.show_pii_onban", false, CVar.SERVERONLY);
|
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
|
* Explosions
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user