Command resolves (#38415)

touchups
This commit is contained in:
Kyle Tyo
2025-06-17 19:40:33 -04:00
committed by GitHub
parent 9a605c8642
commit 284cf25905
3 changed files with 10 additions and 13 deletions

View File

@@ -1,11 +1,9 @@
using System.Linq;
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Radiation.Components; using Content.Server.Radiation.Components;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Radiation.Events; using Content.Shared.Radiation.Events;
using Content.Shared.Radiation.Systems; using Content.Shared.Radiation.Systems;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.Debugging;
using Robust.Shared.Enums; using Robust.Shared.Enums;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
using Robust.Shared.Player; using Robust.Shared.Player;

View File

@@ -11,17 +11,17 @@ using Robust.Shared.Console;
namespace Content.Server.Sandbox.Commands namespace Content.Server.Sandbox.Commands
{ {
[AnyCommand] [AnyCommand]
public sealed class ColorNetworkCommand : LocalizedCommands public sealed class ColorNetworkCommand : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly AtmosPipeColorSystem _pipeColorSystem = default!;
[Dependency] private readonly SandboxSystem _sandboxSystem = default!;
public override string Command => "colornetwork"; public override string Command => "colornetwork";
public override void Execute(IConsoleShell shell, string argStr, string[] args) public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var sandboxManager = _entManager.System<SandboxSystem>(); if (shell.IsClient || (!_sandboxSystem.IsSandboxEnabled && !_adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
var adminManager = IoCManager.Resolve<IAdminManager>();
if (shell.IsClient || (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
{ {
shell.WriteError(Loc.GetString("cmd-colornetwork-no-access")); shell.WriteError(Loc.GetString("cmd-colornetwork-no-access"));
} }
@@ -40,13 +40,13 @@ namespace Content.Server.Sandbox.Commands
var nent = new NetEntity(targetId); var nent = new NetEntity(targetId);
if (!_entManager.TryGetEntity(nent, out var eUid)) if (!EntityManager.TryGetEntity(nent, out var eUid))
{ {
shell.WriteLine(Loc.GetString("shell-invalid-entity-id")); shell.WriteLine(Loc.GetString("shell-invalid-entity-id"));
return; return;
} }
if (!_entManager.TryGetComponent(eUid, out NodeContainerComponent? nodeContainerComponent)) if (!EntityManager.TryGetComponent(eUid, out NodeContainerComponent? nodeContainerComponent))
{ {
shell.WriteLine(Loc.GetString("shell-entity-is-not-node-container")); shell.WriteLine(Loc.GetString("shell-entity-is-not-node-container"));
return; return;
@@ -77,10 +77,10 @@ namespace Content.Server.Sandbox.Commands
foreach (var x in group.Nodes) foreach (var x in group.Nodes)
{ {
if (!_entManager.TryGetComponent(x.Owner, out AtmosPipeColorComponent? atmosPipeColorComponent)) if (!EntityManager.TryGetComponent(x.Owner, out AtmosPipeColorComponent? atmosPipeColorComponent))
continue; continue;
_entManager.System<AtmosPipeColorSystem>().SetColor(x.Owner, atmosPipeColorComponent, color); _pipeColorSystem.SetColor(x.Owner, atmosPipeColorComponent, color);
} }
} }
} }

View File

@@ -249,10 +249,9 @@ namespace Content.Server.Voting
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{ {
var mgr = IoCManager.Resolve<IVoteManager>();
if (args.Length == 1) if (args.Length == 1)
{ {
var options = mgr.ActiveVotes var options = _voteManager.ActiveVotes
.OrderBy(v => v.Id) .OrderBy(v => v.Id)
.Select(v => new CompletionOption(v.Id.ToString(), v.Title)); .Select(v => new CompletionOption(v.Id.ToString(), v.Title));