Command resolves. (#38519)

* banlist-command

* open-admin-notes-command

* stealthmin-command

* set-alert-level-command

* remove unused usings

* whitelist commands
This commit is contained in:
Kyle Tyo
2025-06-22 20:40:55 -04:00
committed by GitHub
parent e925ff6127
commit 69b3e355e4
7 changed files with 50 additions and 65 deletions

View File

@@ -2,16 +2,15 @@
using Content.Server.Administration;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Shared.Console;
namespace Content.Server.AlertLevel.Commands
{
[UsedImplicitly]
[AdminCommand(AdminFlags.Fun)]
public sealed class SetAlertLevelCommand : LocalizedCommands
public sealed class SetAlertLevelCommand : LocalizedEntityCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystems = default!;
[Dependency] private readonly AlertLevelSystem _alertLevelSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
public override string Command => "setalertlevel";
@@ -21,11 +20,9 @@ namespace Content.Server.AlertLevel.Commands
var player = shell.Player;
if (player?.AttachedEntity != null)
{
var stationUid = _entitySystems.GetEntitySystem<StationSystem>().GetOwningStation(player.AttachedEntity.Value);
var stationUid = _stationSystem.GetOwningStation(player.AttachedEntity.Value);
if (stationUid != null)
{
levelNames = GetStationLevelNames(stationUid.Value);
}
}
return args.Length switch
@@ -60,7 +57,7 @@ namespace Content.Server.AlertLevel.Commands
return;
}
var stationUid = _entitySystems.GetEntitySystem<StationSystem>().GetOwningStation(player.AttachedEntity.Value);
var stationUid = _stationSystem.GetOwningStation(player.AttachedEntity.Value);
if (stationUid == null)
{
shell.WriteLine(LocalizationManager.GetString("cmd-setalertlevel-invalid-grid"));
@@ -75,13 +72,12 @@ namespace Content.Server.AlertLevel.Commands
return;
}
_entitySystems.GetEntitySystem<AlertLevelSystem>().SetLevel(stationUid.Value, level, true, true, true, locked);
_alertLevelSystem.SetLevel(stationUid.Value, level, true, true, true, locked);
}
private string[] GetStationLevelNames(EntityUid station)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.TryGetComponent<AlertLevelComponent>(station, out var alertLevelComp))
if (!EntityManager.TryGetComponent<AlertLevelComponent>(station, out var alertLevelComp))
return new string[]{};
if (alertLevelComp.AlertLevels == null)