diff --git a/Content.Client/Audio/AmbientOverlayCommand.cs b/Content.Client/Audio/AmbientOverlayCommand.cs index 909353cd24..7bbc6c6cbf 100644 --- a/Content.Client/Audio/AmbientOverlayCommand.cs +++ b/Content.Client/Audio/AmbientOverlayCommand.cs @@ -2,16 +2,16 @@ using Robust.Shared.Console; namespace Content.Client.Audio; -public sealed class AmbientOverlayCommand : IConsoleCommand +public sealed class AmbientOverlayCommand : LocalizedEntityCommands { - public string Command => "showambient"; - 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().GetEntitySystem(); - system.OverlayEnabled ^= true; + [Dependency] private readonly AmbientSoundSystem _ambient = default!; - 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))); } } diff --git a/Content.Client/Changelog/ChangelogWindow.xaml.cs b/Content.Client/Changelog/ChangelogWindow.xaml.cs index f46ffa7b91..d82c34254c 100644 --- a/Content.Client/Changelog/ChangelogWindow.xaml.cs +++ b/Content.Client/Changelog/ChangelogWindow.xaml.cs @@ -15,8 +15,8 @@ namespace Content.Client.Changelog [GenerateTypedNameReferences] public sealed partial class ChangelogWindow : FancyWindow { - [Dependency] private readonly ChangelogManager _changelog = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!; + [Dependency] private readonly ChangelogManager _changelog = default!; public ChangelogWindow() { @@ -112,15 +112,15 @@ namespace Content.Client.Changelog } [UsedImplicitly, AnyCommand] - public sealed class ChangelogCommand : IConsoleCommand + public sealed class ChangelogCommand : LocalizedCommands { - public string Command => "changelog"; - public string Description => "Opens the changelog"; - public string Help => "Usage: changelog"; + [Dependency] private readonly IUserInterfaceManager _uiManager = default!; - 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().GetUIController().OpenWindow(); + _uiManager.GetUIController().OpenWindow(); } } } diff --git a/Content.Client/Decals/ToggleDecalCommand.cs b/Content.Client/Decals/ToggleDecalCommand.cs index 025ed1299d..cf7113cb50 100644 --- a/Content.Client/Decals/ToggleDecalCommand.cs +++ b/Content.Client/Decals/ToggleDecalCommand.cs @@ -1,17 +1,15 @@ using Robust.Shared.Console; -using Robust.Shared.GameObjects; 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 string Description => "Toggles decaloverlay"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "toggledecals"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - _e.System().ToggleOverlay(); + _decal.ToggleOverlay(); } } diff --git a/Content.Client/Ghost/Commands/ToggleGhostVisibilityCommand.cs b/Content.Client/Ghost/Commands/ToggleGhostVisibilityCommand.cs index 480da6ad8d..3dacc81f21 100644 --- a/Content.Client/Ghost/Commands/ToggleGhostVisibilityCommand.cs +++ b/Content.Client/Ghost/Commands/ToggleGhostVisibilityCommand.cs @@ -2,25 +2,17 @@ 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 string Description => "Toggles ghost visibility on the client."; - public string Help => "toggleghostvisibility [bool]"; + public override string Command => "toggleghostvisibility"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var ghostSystem = _entSysMan.GetEntitySystem(); - if (args.Length != 0 && bool.TryParse(args[0], out var visibility)) - { - ghostSystem.ToggleGhostVisibility(visibility); - } + _ghost.ToggleGhostVisibility(visibility); else - { - ghostSystem.ToggleGhostVisibility(); - } + _ghost.ToggleGhostVisibility(); } } diff --git a/Content.Client/Ghost/GhostToggleSelfVisibility.cs b/Content.Client/Ghost/GhostToggleSelfVisibility.cs index bc4531ce92..fea9a2fc0d 100644 --- a/Content.Client/Ghost/GhostToggleSelfVisibility.cs +++ b/Content.Client/Ghost/GhostToggleSelfVisibility.cs @@ -4,28 +4,27 @@ using Robust.Shared.Console; namespace Content.Client.Ghost; -public sealed class GhostToggleSelfVisibility : IConsoleCommand +public sealed class GhostToggleSelfVisibility : LocalizedEntityCommands { - public string Command => "toggleselfghost"; - public string Description => "Toggles seeing your own ghost."; - public string Help => "toggleselfghost"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + [Dependency] private readonly SpriteSystem _sprite = default!; + + public override string Command => "toggleselfghost"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var attachedEntity = shell.Player?.AttachedEntity; if (!attachedEntity.HasValue) return; - var entityManager = IoCManager.Resolve(); - if (!entityManager.HasComponent(attachedEntity)) + if (!EntityManager.HasComponent(attachedEntity)) { - shell.WriteError("Entity must be a ghost."); + shell.WriteError(Loc.GetString($"cmd-toggleselfghost-must-be-ghost")); return; } - if (!entityManager.TryGetComponent(attachedEntity, out SpriteComponent? spriteComponent)) + if (!EntityManager.TryGetComponent(attachedEntity, out SpriteComponent? spriteComponent)) return; - var spriteSys = entityManager.System(); - spriteSys.SetVisible((attachedEntity.Value, spriteComponent), !spriteComponent.Visible); + _sprite.SetVisible((attachedEntity.Value, spriteComponent), !spriteComponent.Visible); } } diff --git a/Content.Client/NPC/ShowHTNCommand.cs b/Content.Client/NPC/ShowHTNCommand.cs index b6adc0759f..c1f0027087 100644 --- a/Content.Client/NPC/ShowHTNCommand.cs +++ b/Content.Client/NPC/ShowHTNCommand.cs @@ -3,14 +3,14 @@ using Robust.Shared.Console; namespace Content.Client.NPC; -public sealed class ShowHTNCommand : IConsoleCommand +public sealed class ShowHtnCommand : LocalizedEntityCommands { - public string Command => "showhtn"; - public string Description => "Shows the current status for HTN NPCs"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + [Dependency] private readonly HTNSystem _htnSystem = default!; + + public override string Command => "showhtn"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var npcs = IoCManager.Resolve().GetEntitySystem(); - npcs.EnableOverlay ^= true; + _htnSystem.EnableOverlay ^= true; } } diff --git a/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs b/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs index 2d561ba5f2..8f519e61ac 100644 --- a/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs +++ b/Content.Client/NetworkConfigurator/Systems/NetworkConfiguratorSystem.cs @@ -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 string Description => "Clear all network link overlays."; - public string Help => Command; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "clearnetworklinkoverlays"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - _e.System().ClearAllOverlays(); + _network.ClearAllOverlays(); } } diff --git a/Content.Client/NodeContainer/NodeVisCommand.cs b/Content.Client/NodeContainer/NodeVisCommand.cs index 249c0d9427..e5f0f8f5fa 100644 --- a/Content.Client/NodeContainer/NodeVisCommand.cs +++ b/Content.Client/NodeContainer/NodeVisCommand.cs @@ -1,48 +1,39 @@ using Content.Client.Administration.Managers; using Content.Shared.Administration; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; 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 string Description => "Toggles node group visualization"; - public string Help => ""; + public override string Command => "nodevis"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var adminMan = IoCManager.Resolve(); - if (!adminMan.HasFlag(AdminFlags.Debug)) + if (!_adminManager.HasFlag(AdminFlags.Debug)) { - shell.WriteError("You need +DEBUG for this command"); + shell.WriteError(Loc.GetString($"shell-missing-required-permission", ("perm", "+DEBUG"))); return; } - var sys = _e.System(); - sys.SetVisEnabled(!sys.VisEnabled); + _nodeSystem.SetVisEnabled(!_nodeSystem.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 string Description => "Toggles showing a specific group on nodevis"; - public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off"; + public override string Command => "nodevisfilter"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var sys = _e.System(); - if (args.Length == 0) { - foreach (var filtered in sys.Filtered) + foreach (var filtered in _nodeSystem.Filtered) { shell.WriteLine(filtered); } @@ -50,10 +41,8 @@ namespace Content.Client.NodeContainer else { var filter = args[0]; - if (!sys.Filtered.Add(filter)) - { - sys.Filtered.Remove(filter); - } + if (!_nodeSystem.Filtered.Add(filter)) + _nodeSystem.Filtered.Remove(filter); } } } diff --git a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs index b9dd11f7a7..7cb2b37085 100644 --- a/Content.Client/Voting/UI/VoteCallMenu.xaml.cs +++ b/Content.Client/Voting/UI/VoteCallMenu.xaml.cs @@ -274,13 +274,11 @@ namespace Content.Client.Voting.UI } [UsedImplicitly, AnyCommand] - public sealed class VoteMenuCommand : IConsoleCommand + public sealed class VoteMenuCommand : LocalizedCommands { - public 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 override string Command => "votemenu"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { new VoteCallMenu().OpenCentered(); } diff --git a/Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs b/Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs index 861d7d75c6..42456d232b 100644 --- a/Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs +++ b/Content.Client/Weapons/Ranged/Commands/ShowSpreadCommand.cs @@ -1,18 +1,18 @@ using Content.Client.Weapons.Ranged.Systems; 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"; - 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().GetEntitySystem(); - system.SpreadOverlay ^= true; + [Dependency] private readonly GunSystem _gunSystem = default!; - 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))); } } diff --git a/Resources/Locale/en-US/changelog/changelog-window.ftl b/Resources/Locale/en-US/changelog/changelog-window.ftl index 514b2eb1d1..4ee5552282 100644 --- a/Resources/Locale/en-US/changelog/changelog-window.ftl +++ b/Resources/Locale/en-US/changelog/changelog-window.ftl @@ -14,3 +14,6 @@ changelog-button-new-entries = Changelog (new!) changelog-tab-title-Changelog = Changelog changelog-tab-title-Admin = Admin changelog-tab-title-Maps = Maps + +cmd-changelog-desc = Opens the changelog. +cmd-changelog-help = Usage: changelog diff --git a/Resources/Locale/en-US/commands/ghost-visibility-commands.ftl b/Resources/Locale/en-US/commands/ghost-visibility-commands.ftl new file mode 100644 index 0000000000..a4eaed21f6 --- /dev/null +++ b/Resources/Locale/en-US/commands/ghost-visibility-commands.ftl @@ -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. diff --git a/Resources/Locale/en-US/commands/node-vis-commands.ftl b/Resources/Locale/en-US/commands/node-vis-commands.ftl new file mode 100644 index 0000000000..e921c478f8 --- /dev/null +++ b/Resources/Locale/en-US/commands/node-vis-commands.ftl @@ -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 diff --git a/Resources/Locale/en-US/commands/show-ambient-command.ftl b/Resources/Locale/en-US/commands/show-ambient-command.ftl new file mode 100644 index 0000000000..262bbca47b --- /dev/null +++ b/Resources/Locale/en-US/commands/show-ambient-command.ftl @@ -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}. diff --git a/Resources/Locale/en-US/commands/show-gun-spread-command.ftl b/Resources/Locale/en-US/commands/show-gun-spread-command.ftl new file mode 100644 index 0000000000..a4a043e92e --- /dev/null +++ b/Resources/Locale/en-US/commands/show-gun-spread-command.ftl @@ -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}. diff --git a/Resources/Locale/en-US/commands/show-htn-command.ftl b/Resources/Locale/en-US/commands/show-htn-command.ftl new file mode 100644 index 0000000000..6580a41b98 --- /dev/null +++ b/Resources/Locale/en-US/commands/show-htn-command.ftl @@ -0,0 +1,2 @@ +cmd-showhtn-desc = Shows the current status for HTN NPCs. +cmd-showhtn-help = Usage: showhtn diff --git a/Resources/Locale/en-US/commands/toggle-decals-command.ftl b/Resources/Locale/en-US/commands/toggle-decals-command.ftl new file mode 100644 index 0000000000..0455704b3b --- /dev/null +++ b/Resources/Locale/en-US/commands/toggle-decals-command.ftl @@ -0,0 +1,2 @@ +cmd-toggledecals-desc = Toggles decal overlay. +cmd-toggledecals-help = Usage: toggledecals diff --git a/Resources/Locale/en-US/devices/network-configurator.ftl b/Resources/Locale/en-US/devices/network-configurator.ftl index cd4955ed36..8e0724b41e 100644 --- a/Resources/Locale/en-US/devices/network-configurator.ftl +++ b/Resources/Locale/en-US/devices/network-configurator.ftl @@ -43,3 +43,7 @@ network-configurator-examine-switch-modes = Press {$key} to switch modes # item status network-configurator-item-status-label = Mode: {$mode} Switch: {$keybinding} + +# command +cmd-clearnetworklinkoverlays-desc = Clear all network link overlays. +cmd-clearnetworklinkoverlays-help = Usage: clearnetworklinkoverlays diff --git a/Resources/Locale/en-US/shell.ftl b/Resources/Locale/en-US/shell.ftl index 3661c45cb0..295eda8879 100644 --- a/Resources/Locale/en-US/shell.ftl +++ b/Resources/Locale/en-US/shell.ftl @@ -25,6 +25,7 @@ shell-argument-uid = EntityUid ## Guards +shell-missing-required-permission = You need {$perm} for this command! shell-entity-is-not-mob = Target entity is not a mob! shell-invalid-entity-id = Invalid entity ID. shell-invalid-grid-id = Invalid grid ID. diff --git a/Resources/Locale/en-US/voting/ui/vote-call-menu.ftl b/Resources/Locale/en-US/voting/ui/vote-call-menu.ftl index 82e3a5d1f8..de95b50055 100644 --- a/Resources/Locale/en-US/voting/ui/vote-call-menu.ftl +++ b/Resources/Locale/en-US/voting/ui/vote-call-menu.ftl @@ -38,5 +38,5 @@ ui-vote-fluff = Powered by Robust™ Anti-Tamper Technology ## Vote menu command -ui-vote-menu-command-description = Opens the voting menu -ui-vote-menu-command-help-text = Usage: votemenu +cmd-votemenu-desc = Opens the voting menu. +cmd-votemenu-help = Usage: votemenu