Command resolve killing, LEC conversions, and general cleanup. (#38338)

* i'm just gonna put this here.

* I'm just gonna do it.

* Update ShowHTNCommand.cs

* I feel dumb.

* may as well with this too.

* this does in fact not work

* :/
This commit is contained in:
Kyle Tyo
2025-06-17 14:08:12 -04:00
committed by GitHub
parent 0e1ff2644f
commit 9d22f6147c
20 changed files with 111 additions and 106 deletions

View File

@@ -2,16 +2,16 @@ using Robust.Shared.Console;
namespace Content.Client.Audio; namespace Content.Client.Audio;
public sealed class AmbientOverlayCommand : IConsoleCommand public sealed class AmbientOverlayCommand : LocalizedEntityCommands
{ {
public string Command => "showambient"; [Dependency] private readonly AmbientSoundSystem _ambient = default!;
public string Description => "Shows all AmbientSoundComponents in the viewport";
public string Help => $"{Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AmbientSoundSystem>();
system.OverlayEnabled ^= true;
shell.WriteLine($"Ambient sound overlay set to {system.OverlayEnabled}"); public override string Command => "showambient";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
_ambient.OverlayEnabled ^= true;
shell.WriteLine(Loc.GetString($"cmd-showambient-status", ("status", _ambient.OverlayEnabled)));
} }
} }

View File

@@ -15,8 +15,8 @@ namespace Content.Client.Changelog
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class ChangelogWindow : FancyWindow public sealed partial class ChangelogWindow : FancyWindow
{ {
[Dependency] private readonly ChangelogManager _changelog = default!;
[Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly ChangelogManager _changelog = default!;
public ChangelogWindow() public ChangelogWindow()
{ {
@@ -112,15 +112,15 @@ namespace Content.Client.Changelog
} }
[UsedImplicitly, AnyCommand] [UsedImplicitly, AnyCommand]
public sealed class ChangelogCommand : IConsoleCommand public sealed class ChangelogCommand : LocalizedCommands
{ {
public string Command => "changelog"; [Dependency] private readonly IUserInterfaceManager _uiManager = default!;
public string Description => "Opens the changelog";
public string Help => "Usage: changelog";
public void Execute(IConsoleShell shell, string argStr, string[] args) public override string Command => "changelog";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<ChangelogUIController>().OpenWindow(); _uiManager.GetUIController<ChangelogUIController>().OpenWindow();
} }
} }
} }

View File

@@ -1,17 +1,15 @@
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects;
namespace Content.Client.Decals; namespace Content.Client.Decals;
public sealed class ToggleDecalCommand : IConsoleCommand public sealed class ToggleDecalCommand : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntityManager _e = default!; [Dependency] private readonly DecalSystem _decal = default!;
public string Command => "toggledecals"; public override string Command => "toggledecals";
public string Description => "Toggles decaloverlay";
public string Help => $"{Command}"; public override void Execute(IConsoleShell shell, string argStr, string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
_e.System<DecalSystem>().ToggleOverlay(); _decal.ToggleOverlay();
} }
} }

View File

@@ -2,25 +2,17 @@
namespace Content.Client.Ghost.Commands; namespace Content.Client.Ghost.Commands;
public sealed class ToggleGhostVisibilityCommand : IConsoleCommand public sealed class ToggleGhostVisibilityCommand : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntitySystemManager _entSysMan = default!; [Dependency] private readonly GhostSystem _ghost = default!;
public string Command => "toggleghostvisibility"; public override string Command => "toggleghostvisibility";
public string Description => "Toggles ghost visibility on the client.";
public string Help => "toggleghostvisibility [bool]";
public void Execute(IConsoleShell shell, string argStr, string[] args) public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var ghostSystem = _entSysMan.GetEntitySystem<GhostSystem>();
if (args.Length != 0 && bool.TryParse(args[0], out var visibility)) if (args.Length != 0 && bool.TryParse(args[0], out var visibility))
{ _ghost.ToggleGhostVisibility(visibility);
ghostSystem.ToggleGhostVisibility(visibility);
}
else else
{ _ghost.ToggleGhostVisibility();
ghostSystem.ToggleGhostVisibility();
}
} }
} }

View File

@@ -4,28 +4,27 @@ using Robust.Shared.Console;
namespace Content.Client.Ghost; namespace Content.Client.Ghost;
public sealed class GhostToggleSelfVisibility : IConsoleCommand public sealed class GhostToggleSelfVisibility : LocalizedEntityCommands
{ {
public string Command => "toggleselfghost"; [Dependency] private readonly SpriteSystem _sprite = default!;
public string Description => "Toggles seeing your own ghost.";
public string Help => "toggleselfghost"; public override string Command => "toggleselfghost";
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var attachedEntity = shell.Player?.AttachedEntity; var attachedEntity = shell.Player?.AttachedEntity;
if (!attachedEntity.HasValue) if (!attachedEntity.HasValue)
return; return;
var entityManager = IoCManager.Resolve<IEntityManager>(); if (!EntityManager.HasComponent<GhostComponent>(attachedEntity))
if (!entityManager.HasComponent<GhostComponent>(attachedEntity))
{ {
shell.WriteError("Entity must be a ghost."); shell.WriteError(Loc.GetString($"cmd-toggleselfghost-must-be-ghost"));
return; return;
} }
if (!entityManager.TryGetComponent(attachedEntity, out SpriteComponent? spriteComponent)) if (!EntityManager.TryGetComponent(attachedEntity, out SpriteComponent? spriteComponent))
return; return;
var spriteSys = entityManager.System<SpriteSystem>(); _sprite.SetVisible((attachedEntity.Value, spriteComponent), !spriteComponent.Visible);
spriteSys.SetVisible((attachedEntity.Value, spriteComponent), !spriteComponent.Visible);
} }
} }

View File

@@ -3,14 +3,14 @@ using Robust.Shared.Console;
namespace Content.Client.NPC; namespace Content.Client.NPC;
public sealed class ShowHTNCommand : IConsoleCommand public sealed class ShowHtnCommand : LocalizedEntityCommands
{ {
public string Command => "showhtn"; [Dependency] private readonly HTNSystem _htnSystem = default!;
public string Description => "Shows the current status for HTN NPCs";
public string Help => $"{Command}"; public override string Command => "showhtn";
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var npcs = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<HTNSystem>(); _htnSystem.EnableOverlay ^= true;
npcs.EnableOverlay ^= true;
} }
} }

View File

@@ -137,15 +137,14 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
} }
} }
public sealed class ClearAllNetworkLinkOverlays : IConsoleCommand public sealed class ClearAllNetworkLinkOverlays : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntityManager _e = default!; [Dependency] private readonly NetworkConfiguratorSystem _network = default!;
public string Command => "clearnetworklinkoverlays"; public override string Command => "clearnetworklinkoverlays";
public string Description => "Clear all network link overlays.";
public string Help => Command; public override void Execute(IConsoleShell shell, string argStr, string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
_e.System<NetworkConfiguratorSystem>().ClearAllOverlays(); _network.ClearAllOverlays();
} }
} }

View File

@@ -1,48 +1,39 @@
using Content.Client.Administration.Managers; using Content.Client.Administration.Managers;
using Content.Shared.Administration; using Content.Shared.Administration;
using Robust.Shared.Console; using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.NodeContainer namespace Content.Client.NodeContainer
{ {
public sealed class NodeVisCommand : IConsoleCommand public sealed class NodeVisCommand : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntityManager _e = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly NodeGroupSystem _nodeSystem = default!;
public string Command => "nodevis"; public override string Command => "nodevis";
public string Description => "Toggles node group visualization";
public string Help => "";
public void Execute(IConsoleShell shell, string argStr, string[] args) public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var adminMan = IoCManager.Resolve<IClientAdminManager>(); if (!_adminManager.HasFlag(AdminFlags.Debug))
if (!adminMan.HasFlag(AdminFlags.Debug))
{ {
shell.WriteError("You need +DEBUG for this command"); shell.WriteError(Loc.GetString($"shell-missing-required-permission", ("perm", "+DEBUG")));
return; return;
} }
var sys = _e.System<NodeGroupSystem>(); _nodeSystem.SetVisEnabled(!_nodeSystem.VisEnabled);
sys.SetVisEnabled(!sys.VisEnabled);
} }
} }
public sealed class NodeVisFilterCommand : IConsoleCommand public sealed class NodeVisFilterCommand : LocalizedEntityCommands
{ {
[Dependency] private readonly IEntityManager _e = default!; [Dependency] private readonly NodeGroupSystem _nodeSystem = default!;
public string Command => "nodevisfilter"; public override string Command => "nodevisfilter";
public string Description => "Toggles showing a specific group on nodevis";
public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off";
public void Execute(IConsoleShell shell, string argStr, string[] args) public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var sys = _e.System<NodeGroupSystem>();
if (args.Length == 0) if (args.Length == 0)
{ {
foreach (var filtered in sys.Filtered) foreach (var filtered in _nodeSystem.Filtered)
{ {
shell.WriteLine(filtered); shell.WriteLine(filtered);
} }
@@ -50,10 +41,8 @@ namespace Content.Client.NodeContainer
else else
{ {
var filter = args[0]; var filter = args[0];
if (!sys.Filtered.Add(filter)) if (!_nodeSystem.Filtered.Add(filter))
{ _nodeSystem.Filtered.Remove(filter);
sys.Filtered.Remove(filter);
}
} }
} }
} }

View File

@@ -274,13 +274,11 @@ namespace Content.Client.Voting.UI
} }
[UsedImplicitly, AnyCommand] [UsedImplicitly, AnyCommand]
public sealed class VoteMenuCommand : IConsoleCommand public sealed class VoteMenuCommand : LocalizedCommands
{ {
public string Command => "votemenu"; public override string Command => "votemenu";
public string Description => Loc.GetString("ui-vote-menu-command-description");
public string Help => Loc.GetString("ui-vote-menu-command-help-text");
public void Execute(IConsoleShell shell, string argStr, string[] args) public override void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
new VoteCallMenu().OpenCentered(); new VoteCallMenu().OpenCentered();
} }

View File

@@ -1,18 +1,18 @@
using Content.Client.Weapons.Ranged.Systems; using Content.Client.Weapons.Ranged.Systems;
using Robust.Shared.Console; using Robust.Shared.Console;
namespace Content.Client.Weapons.Ranged; namespace Content.Client.Weapons.Ranged.Commands;
public sealed class ShowSpreadCommand : IConsoleCommand public sealed class ShowSpreadCommand : LocalizedEntityCommands
{ {
public string Command => "showgunspread"; [Dependency] private readonly GunSystem _gunSystem = default!;
public string Description => $"Shows gun spread overlay for debugging";
public string Help => $"{Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GunSystem>();
system.SpreadOverlay ^= true;
shell.WriteLine($"Set spread overlay to {system.SpreadOverlay}"); public override string Command => "showgunspread";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
_gunSystem.SpreadOverlay ^= true;
shell.WriteLine(Loc.GetString($"cmd-showgunspread-status", ("status", _gunSystem.SpreadOverlay)));
} }
} }

View File

@@ -14,3 +14,6 @@ changelog-button-new-entries = Changelog (new!)
changelog-tab-title-Changelog = Changelog changelog-tab-title-Changelog = Changelog
changelog-tab-title-Admin = Admin changelog-tab-title-Admin = Admin
changelog-tab-title-Maps = Maps changelog-tab-title-Maps = Maps
cmd-changelog-desc = Opens the changelog.
cmd-changelog-help = Usage: changelog

View File

@@ -0,0 +1,6 @@
cmd-toggleghostvisibility-desc = Toggles ghost visibility on the client.
cmd-toggleghostvisibility-help = Usage: toggleghostvisibility [bool]
cmd-toggleselfghost-desc = Toggles seeing your own ghost.
cmd-toggleselfghost-help = Usage: toggleselfghost
cmd-toggleselfghost-must-be-ghost = Entity must be a ghost.

View File

@@ -0,0 +1,6 @@
cmd-nodevis-desc = Toggles node group visualization.
cmd-nodevis-help = Usage: nodevis
cmd-nodevisfilter-desc = Toggles showing a specific group on nodevis.
cmd-nodevisfilter-help = Usage: nodevisfilter [filter]
Omit filter to list currently masked-off

View File

@@ -0,0 +1,3 @@
cmd-showambient-desc = Shows all AmbientSoundComponents in the viewport.
cmd-showambient-help = Usage: showambient
cmd-showambient-status = Ambient sound overlay set to {$status}.

View File

@@ -0,0 +1,3 @@
cmd-showgunspread-desc = Shows gun spread overlay for debugging.
cmd-showgunspreade-help = Usage: showgunspread
cmd-showgunspread-status = Set spread overlay to {$status}.

View File

@@ -0,0 +1,2 @@
cmd-showhtn-desc = Shows the current status for HTN NPCs.
cmd-showhtn-help = Usage: showhtn

View File

@@ -0,0 +1,2 @@
cmd-toggledecals-desc = Toggles decal overlay.
cmd-toggledecals-help = Usage: toggledecals

View File

@@ -43,3 +43,7 @@ network-configurator-examine-switch-modes = Press {$key} to switch modes
# item status # item status
network-configurator-item-status-label = Mode: {$mode} network-configurator-item-status-label = Mode: {$mode}
Switch: {$keybinding} Switch: {$keybinding}
# command
cmd-clearnetworklinkoverlays-desc = Clear all network link overlays.
cmd-clearnetworklinkoverlays-help = Usage: clearnetworklinkoverlays

View File

@@ -25,6 +25,7 @@ shell-argument-uid = EntityUid
## Guards ## Guards
shell-missing-required-permission = You need {$perm} for this command!
shell-entity-is-not-mob = Target entity is not a mob! shell-entity-is-not-mob = Target entity is not a mob!
shell-invalid-entity-id = Invalid entity ID. shell-invalid-entity-id = Invalid entity ID.
shell-invalid-grid-id = Invalid grid ID. shell-invalid-grid-id = Invalid grid ID.

View File

@@ -38,5 +38,5 @@ ui-vote-fluff = Powered by Robust™ Anti-Tamper Technology
## Vote menu command ## Vote menu command
ui-vote-menu-command-description = Opens the voting menu cmd-votemenu-desc = Opens the voting menu.
ui-vote-menu-command-help-text = Usage: votemenu cmd-votemenu-help = Usage: votemenu