-using System.Linq;
using Content.Server.Administration;
using Content.Server.Radiation.Components;
using Content.Shared.Administration;
using Content.Shared.Radiation.Events;
using Content.Shared.Radiation.Systems;
using Robust.Shared.Console;
-using Robust.Shared.Debugging;
using Robust.Shared.Enums;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
namespace Content.Server.Sandbox.Commands
{
[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 void Execute(IConsoleShell shell, string argStr, string[] args)
{
- var sandboxManager = _entManager.System<SandboxSystem>();
- var adminManager = IoCManager.Resolve<IAdminManager>();
- if (shell.IsClient || (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
+ if (shell.IsClient || (!_sandboxSystem.IsSandboxEnabled && !_adminManager.HasAdminFlag(shell.Player!, AdminFlags.Mapping)))
{
shell.WriteError(Loc.GetString("cmd-colornetwork-no-access"));
}
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"));
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"));
return;
foreach (var x in group.Nodes)
{
- if (!_entManager.TryGetComponent(x.Owner, out AtmosPipeColorComponent? atmosPipeColorComponent))
+ if (!EntityManager.TryGetComponent(x.Owner, out AtmosPipeColorComponent? atmosPipeColorComponent))
continue;
- _entManager.System<AtmosPipeColorSystem>().SetColor(x.Owner, atmosPipeColorComponent, color);
+ _pipeColorSystem.SetColor(x.Owner, atmosPipeColorComponent, color);
}
}
}