]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix deadmin on join cvar for nukies (#20198)
authorLankLTE <135308300+LankLTE@users.noreply.github.com>
Sat, 6 Jan 2024 09:29:53 +0000 (01:29 -0800)
committerGitHub <noreply@github.com>
Sat, 6 Jan 2024 09:29:53 +0000 (20:29 +1100)
* fix

* oops

Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs

index 870586e554df64caeb21b340f33eb13abe8f2a29..5bce7f20e44713b2a4df825e25b3114d0ce41e52 100644 (file)
@@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Numerics;
 using Content.Server.Administration.Commands;
+using Content.Server.Administration.Managers;
 using Content.Server.Chat.Managers;
 using Content.Server.Chat.Systems;
 using Content.Server.Communications;
@@ -27,6 +28,7 @@ using Content.Server.Station.Components;
 using Content.Server.Station.Systems;
 using Content.Server.Store.Components;
 using Content.Server.Store.Systems;
+using Content.Shared.CCVar;
 using Content.Shared.Dataset;
 using Content.Shared.Humanoid;
 using Content.Shared.Humanoid.Prototypes;
@@ -52,6 +54,7 @@ using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
 using Robust.Shared.Utility;
+using Robust.Shared.Configuration;
 
 namespace Content.Server.GameTicking.Rules;
 
@@ -80,6 +83,8 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
     [Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
     [Dependency] private readonly StoreSystem _store = default!;
     [Dependency] private readonly TagSystem _tag = default!;
+    [Dependency] private readonly IAdminManager _adminManager = default!;
+    [Dependency] private readonly IConfigurationManager _cfg = default!;
     [Dependency] private readonly WarDeclaratorSystem _warDeclarator = default!;
 
 
@@ -962,6 +967,10 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
                 _mind.SetUserId(newMind, session.UserId);
                 _roles.MindAddRole(newMind, new NukeopsRoleComponent { PrototypeId = spawnDetails.Role });
 
+                // Automatically de-admin players who are being made nukeops
+                if (_cfg.GetCVar(CCVars.AdminDeadminOnJoin) && _adminManager.IsAdmin(session))
+                    _adminManager.DeAdmin(session);
+
                 _mind.TransferTo(newMind, mob);
             }
             else if (addSpawnPoints)