Fix late join & observe to de-admin admins. (#28319)

This commit is contained in:
Repo
2024-05-29 06:00:42 +12:00
committed by GitHub
parent 1777eea9a4
commit eb3f27526b
5 changed files with 38 additions and 2 deletions

View File

@@ -1,7 +1,10 @@
using Content.Server.Administration.Managers;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using Content.Shared.Roles;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
@@ -12,6 +15,8 @@ namespace Content.Server.GameTicking.Commands
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
public string Command => "joingame";
public string Description => "";
@@ -67,6 +72,12 @@ namespace Content.Server.GameTicking.Commands
shell.WriteLine($"{jobPrototype.LocalizedName} has no available slots.");
return;
}
if (_adminManager.IsAdmin(player) && _cfg.GetCVar(CCVars.AdminDeadminOnJoin))
{
_adminManager.DeAdmin(player);
}
ticker.MakeJoinGame(player, station, id);
return;
}