From 108e270f9eb196181e71d8ceea87b7254fd631e8 Mon Sep 17 00:00:00 2001 From: Ygg01 Date: Sat, 5 Nov 2022 17:00:57 +0100 Subject: [PATCH] Localize commands (#3374) --- Resources/Locale/en-US/commands.ftl | 348 ++++++++++++++++++ Resources/Locale/en-US/midi-commands.ftl | 2 +- Resources/Locale/pt-BR/midi-commands.ftl | 2 +- .../Audio/Midi/Commands/MidiPanicCommand.cs | 8 +- Robust.Client/Console/ClientConsoleHost.cs | 12 +- .../Console/Commands/AddCompCommand.cs | 16 +- .../Console/Commands/ClientSpawnCommand.cs | 8 +- .../Console/Commands/ConfigurationCommands.cs | 8 +- .../Console/Commands/ConsoleCommands.cs | 16 +- Robust.Client/Console/Commands/Debug.cs | 263 ++++++------- .../Console/Commands/DebugAnchoredCommand.cs | 9 +- .../Commands/DumpMetadataMembersCommand.cs | 8 +- .../Console/Commands/GridChunkBBCommand.cs | 9 +- .../Console/Commands/LauncherAuthCommand.cs | 8 +- .../Console/Commands/LightBBCommand.cs | 9 +- .../Console/Commands/MonitorCommands.cs | 24 +- .../Commands/PhysicsOverlayCommands.cs | 10 +- Robust.Client/Console/Commands/QuitCommand.cs | 16 +- .../Commands/ReloadLocalizationsCommand.cs | 8 +- Robust.Client/Console/Commands/Scripting.cs | 24 +- .../Console/Commands/SendGarbageCommand.cs | 8 +- .../Commands/SetInputContextCommand.cs | 8 +- .../Console/Commands/VelocitiesCommand.cs | 9 +- .../Renderable/SpriteBoundsOverlay.cs | 9 +- .../EntitySystems/DebugEntityLookupSystem.cs | 9 +- Robust.Client/GameStates/NetEntityOverlay.cs | 20 +- Robust.Client/GameStates/NetGraphOverlay.cs | 16 +- Robust.Client/GameStates/NetInterpOverlay.cs | 8 +- Robust.Client/Graphics/Clyde/VramCommand.cs | 8 +- Robust.Client/Input/InputManager.cs | 16 +- .../Physics/DebugPhysicsIslandSystem.cs | 9 +- .../Physics/GridSplitVisualsCommand.cs | 9 +- Robust.Client/Profiling/ProfViewManager.cs | 8 +- .../UserInterface/DevWindow/DevWindow.xaml.cs | 8 +- .../UserInterface/FileDialogManager.cs | 8 +- Robust.Client/UserInterface/UiCommands.cs | 9 +- .../ViewVariables/ViewVariablesCommand.cs | 4 +- Robust.Server/Bql/ForAllCommand.cs | 8 +- .../Console/Commands/AddComponentCommand.cs | 8 +- .../Console/Commands/DeleteCommand.cs | 8 +- Robust.Server/Console/Commands/MapCommands.cs | 108 ++---- .../Console/Commands/PlayerCommands.cs | 35 +- .../Commands/ReloadLocalizationsCommand.cs | 8 +- .../Commands/RemoveComponentCommand.cs | 8 +- .../Console/Commands/ScaleCommand.cs | 8 +- .../Console/Commands/SpawnCommand.cs | 8 +- Robust.Server/Console/Commands/SpinCommand.cs | 8 +- Robust.Server/Console/Commands/SysCommands.cs | 42 +-- .../Console/Commands/TestbedCommand.cs | 9 +- .../Console/Commands/ViewSubscriberCommand.cs | 17 +- .../Configuration/ConfigurationCommands.cs | 11 +- .../Commands/DumpEventTablesCommand.cs | 10 +- .../Commands/DumpNetComponentsCommand.cs | 8 +- Robust.Shared/Console/Commands/ExecCommand.cs | 10 +- Robust.Shared/Console/Commands/GcCommands.cs | 38 +- Robust.Shared/Console/Commands/HelpCommand.cs | 10 +- .../Console/Commands/ListAssembliesCommand.cs | 8 +- Robust.Shared/Console/Commands/ListCommand.cs | 12 +- Robust.Shared/Console/Commands/LogCommands.cs | 28 +- .../Commands/SerializerStatsCommand.cs | 8 +- Robust.Shared/Console/LocalizedCommands.cs | 33 ++ Robust.Shared/Network/HWId.cs | 8 +- .../Commands/ViewVariablesBaseCommand.cs | 9 +- .../Commands/ViewVariablesInvokeCommand.cs | 4 +- .../Commands/ViewVariablesReadCommand.cs | 4 +- .../Commands/ViewVariablesWriteCommand.cs | 4 +- 66 files changed, 793 insertions(+), 661 deletions(-) create mode 100644 Robust.Shared/Console/LocalizedCommands.cs diff --git a/Resources/Locale/en-US/commands.ftl b/Resources/Locale/en-US/commands.ftl index 950af18f8f..3fd074c032 100644 --- a/Resources/Locale/en-US/commands.ftl +++ b/Resources/Locale/en-US/commands.ftl @@ -165,3 +165,351 @@ cmd-hint-savebp-id = cmd-flushcookies-desc = Flush CEF cookie storage to disk cmd-flushcookies-help = This ensure cookies are properly saved to disk in the event of unclean shutdowns. Note that the actual operation is asynchronous. + +cmd-ldrsc-desc = Pre-caches a resource. +cmd-ldrsc-help = Usage: ldrsc + +cmd-rldrsc-desc = Reloads a resource. +cmd-rldrsc-help = Usage: rldrsc + +cmd-gridtc-desc = Gets the tile count of a grid. +cmd-gridtc-help = Usage: gridtc + + +# Client-side commands +cmd-guidump-desc = Dump GUI tree to /guidump.txt in user data. +cmd-guidump-help = Usage: guidump + +cmd-uitest-desc = Open a dummy UI testing window +cmd-uitest-help = Usage: uitest + +cmd-setclipboard-desc = Sets the system clipboard +cmd-setclipboard-help = Usage: setclipboard + +cmd-getclipboard-desc = Gets the system clipboard +cmd-getclipboard-help = Usage: Getclipboard + +cmd-togglelight-desc = Toggles light rendering. +cmd-togglelight-help = Usage: togglelight + +cmd-togglefov-desc = Toggles fov for client. +cmd-togglefov-help = Usage: togglefov + +cmd-togglehardfov-desc = Toggles hard fov for client. (for debugging space-station-14#2353) +cmd-togglehardfov-help = Usage: togglehardfov + +cmd-toggleshadows-desc = Toggles shadow rendering. +cmd-toggleshadows-help = Usage: toggleshadows + +cmd-togglelightbuf-desc = Toggles lighting rendering. This includes shadows but not FOV. +cmd-togglelightbuf-help = Usage: togglelightbuf + +cmd-chunkinfo-desc = Gets info about a chunk under your mouse cursor. +cmd-chunkinfo-help = Usage: chunkinfo + +cmd-rldshader-desc = Reloads all shaders. +cmd-rldshader-help = Usage: rldshader + +cmd-cldbglyr-desc = Toggle fov and light debug layers. +cmd-cldbglyr-help= Usage: cldbglyr : Toggle + cldbglyr: Turn all Layers off + +cmd-key-info-desc = Keys key info for a key. +cmd-key-info-help = Usage: keyinfo + +cmd-bind-desc = Binds an input key to an input command. +cmd-bind-help = bind + +cmd-net-draw-interp-desc = Toggles the debug drawing of the network interpolation. +cmd-net-draw-interp-help = Usage: net_draw_interp + +cmd-net-draw-interp-desc = Toggles the debug drawing of the network interpolation. +cmd-net-draw-interp-help = Usage: net_draw_interp + +cmd-net-watch-ent-desc = Dumps all network updates for an EntityId to the console. +cmd-net-watch-ent-help = Usage: net_watchent <0|EntityUid> + +cmd-net-refresh-desc = Requests a full server state. +cmd-net-refresh-help = Usage: net_refresh + +cmd-net-entity-report-desc = Toggles the net entity report panel. +cmd-net-entity-report-help = Usage: net_entityreport + +cmd-fill-desc = Fill up the console for debugging. +cmd-fill-help = Fills the console with some nonsense for debugging. + +cmd-cls-desc = Clears the console. +cmd-cls-help = Clears the debug console of all messages. + +cmd-sendgarbage-desc = Sends garbage to the server. +cmd-sendgarbage-help = The server will reply with 'no u' + +cmd-loadgrid-desc = Loads a grid from a file into an existing map. +cmd-loadgrid-help = loadgrid [x y] [rotation] [storeUids] + +cmd-loc-desc = Prints the absolute location of the player's entity to console. +cmd-loc-help = loc + +cmd-tpgrid-desc = Teleports a grid to a new location. +cmd-tpgrid-help = tpgrid [] + +cmd-rmgrid-desc = Removes a grid from a map. You cannot remove the default grid. +cmd-rmgrid-help = rmgrid + +cmd-mapinit-desc = Runs map init on a map. +cmd-mapinit-help = mapinit + +cmd-lsmap-desc = Lists maps. +cmd-lsmap-help = lsmap + +cmd-lsgrid-desc = Lists grids. +cmd-lsgrid-help = lsgrid + +cmd-addmap-desc = Adds a new empty map to the round. If the mapID already exists, this command does nothing. +cmd-addmap-help = addmap [initialize] + +cmd-rmmap-desc = Removes a map from the world. You cannot remove nullspace. +cmd-rmmap-help = rmmap + +cmd-savegrid-desc = Serializes a grid to disk. +cmd-savegrid-help = savegrid + +cmd-testbed-desc = Loads a physics testbed on the specified map. +cmd-testbed-help = testbed + +cmd-saveconfig-desc = Saves the client configuration to the config file. +cmd-saveconfig-help = saveconfig + +## 'flushcookies' command +# Note: the flushcookies command is from Robust.Client.WebView, it's not in the main engine code. + +cmd-flushcookies-desc = Flush CEF cookie storage to disk +cmd-flushcookies-help = This ensure cookies are properly saved to disk in the event of unclean shutdowns. + Note that the actual operation is asynchronous. + +## 'addcomp' command +cmd-addcomp-desc = Adds a component to an entity. +cmd-addcomp-help = addcomp +cmd-addcompc-desc = Adds a component to an entity on the client. +cmd-addcompc-help = addcompc + +## 'rmcomp' command +cmd-rmcomp-desc = Removes a component from an entity. +cmd-rmcomp-help = rmcomp +cmd-rmcompc-desc = Removes a component from an entity on the client. +cmd-rmcompc-help = rmcomp + +## 'addview' command +cmd-addview-desc = Allows you to subscribe to an entity's view for debugging purposes. +cmd-addview-help = addview +cmd-addviewc-desc = Allows you to subscribe to an entity's view for debugging purposes. +cmd-addviewc-help = addview + +## 'removeview' command +cmd-removeview-desc = Allows you to unsubscribe to an entity's view for debugging purposes. +cmd-removeview-help = removeview + +## 'loglevel' command +cmd-loglevel-desc = Changes the log level for a provided sawmill. +cmd-loglevel-help = Usage: loglevel + sawmill: A label prefixing log messages. This is the one you're setting the level for. + level: The log level. Must match one of the values of the LogLevel enum. + +cmd-testlog-desc = Writes a test log to a sawmill. +cmd-testlog-help = Usage: testlog + sawmill: A label prefixing the logged message. + level: The log level. Must match one of the values of the LogLevel enum. + message: The message to be logged. Wrap this in double quotes if you want to use spaces. + +## 'vv' command +cmd-vv-desc = Opens View Variables. +cmd-vv-help = Usage: vv + +## 'showvelocities' command +cmd-showvelocities-desc = Displays your angular and linear velocities. +cmd-showvelocities-help = Usage: showvelocities + +## 'setinputcontext' command +cmd-setinputcontext-desc = Sets the active input context. +cmd-setinputcontext-help = Usage: setinputcontext + +## 'forall' command +cmd-forall-desc = Runs a command over all entities with a given component. +cmd-forall-help = Usage: forall do + +## 'delete' command +cmd-delete-desc = Deletes the entity with the specified ID. +cmd-delete-help = delete + +# System commands +cmd-showtime-desc = Shows the server time. +cmd-showtime-help = showtime + +cmd-restart-desc = Gracefully restarts the server (not just the round). +cmd-restart-help = restart + +cmd-shutdown-desc = Gracefully shuts down the server. +cmd-shutdown-help = shutdown + +cmd-saveconfig-desc = Saves the server configuration to the config file. +cmd-saveconfig-help = saveconfig + +cmd-netaudit-desc = Prints into about NetMsg security. +cmd-netaudit-help = netaudit + +# Player commands +cmd-tp-desc = Teleports a player to any location in the round. +cmd-tp-help = tp [] + +cmd-tpto-desc = Teleports the current player or the specified players/entities to the location of last player/entity specified.d. +cmd-tpto-help = tpto [username|uid]... + +cmd-listplayers-desc = Lists all players currently connected. +cmd-listplayers-help = listplayers + +cmd-kick-desc = Kicks a connected player out of the server, disconnecting them. +cmd-kick-help = kick [] + +# Spin command +cmd-spin-desc = Causes an entity to spin. Default entity is the attached player's parent. +cmd-spin-help = spin velocity [drag] [entityUid] + +# Localization command +cmd-rldloc-desc = Reloads localization (client & server). +cmd-rldloc-help = Usage: rldloc + +# Debug entity controls +cmd-spawn-desc = Spawns an entity with specific type. +cmd-spawn-help = spawn OR spawn OR spawn +cmd-cspawn-desc = Spawns a client-side entity with specific type at your feet. +cmd-cspawn-help = cspawn + +cmd-scale-desc = Increases or decreases an entity's size naively. +cmd-scale-help = scale + +cmd-dumpentities-desc = Dump entity list. +cmd-dumpentities-help = Dumps entity list of UIDs and prototype. + +cmd-getcomponentregistration-desc = Gets component registration information. +cmd-getcomponentregistration-help = Usage: getcomponentregistration + +cmd-showrays-desc = Toggles debug drawing of physics rays. An integer for must be provided. +cmd-showrays-help = Usage: showrays + +cmd-disconnect-desc = Immediately disconnect from the server and go back to the main menu. +cmd-disconnect-help = Usage: disconnect + +cmd-entfo-desc = Displays verbose diagnostics for an entity. +cmd-entfo-help = Usage: entfo + The entity UID can be prefixed with 'c' to convert it to a client entity UID. + +cmd-fuck-desc = Throws an exception +cmd-fuck-help = Throws an exception + +cmd-showpos-desc = Enables debug drawing over all entity positions in the game. +cmd-showpos-help = Usage: showpos + +cmd-sggcell-desc = Lists entities on a snap grid cell. +cmd-sggcell-help = Usage: sggcell \nThat vector2i param is in the form x,y. + +cmd-overrideplayername-desc = Changes the name used when attempting to connect to the server. +cmd-overrideplayername-help = Usage: overrideplayername + +cmd-showanchored-desc = Shows anchored entities on a particular tile +cmd-showanchored-help = Usage: showanchored + +cmd-dmetamem-desc = Dumps a type's members in a format suitable for the sandbox configuration file. +cmd-dmetamem-help = Usage: dmetamem + +cmd-dmetamem-desc = Displays chunk bounds for the purposes of rendering. +cmd-dmetamem-help = Usage: showchunkbb + +cmd-launchauth-desc = Load authentication tokens from launcher data to aid in testing of live servers. +cmd-launchauth-help = Usage: launchauth + +cmd-lightbb-desc = Toggles whether to show light bounding boxes. +cmd-lightbb-help = Usage: lightbb + +cmd-monitorinfo-desc = Monitors info +cmd-monitorinfo-help = Usage: monitorinfo + +cmd-setmonitor-desc = Set monitor +cmd-setmonitor-help = Usage: setmonitor + +cmd-physics-desc = Shows a debug physics overlay. The arg supplied specifies the overlay. +cmd-physics-help = Usage: physics + +cmd-hardquit-desc = Kills the game client instantly. +cmd-hardquit-help = Kills the game client instantly, leaving no traces. No telling the server goodbye. + +cmd-quit-desc = Shuts down the game client gracefully. +cmd-quit-help = Properly shuts down the game client, notifying the connected server and such. + +cmd-csi-desc = Opens a C# interactive console. +cmd-csi-help = Usage: csi + +cmd-scsi-desc = Opens a C# interactive console on the server. +cmd-scsi-help = Usage: scsi + +cmd-watch-desc = Opens a variable watch window. +cmd-watch-help = Usage: watch + +cmd-showspritebb-desc = Toggle whether sprite bounds are shown +cmd-showspritebb-help = Usage: showspritebb + +cmd-togglelookup-desc = Shows / hides entitylookup bounds via an overlay. +cmd-togglelookup-help = Usage: togglelookup + +cmd-net_entityreport-desc = Toggles the net entity report panel. +cmd-net_entityreport-help = Usage: net_entityreport + +cmd-net_refresh-desc = Requests a full server state. +cmd-net_refresh-help = Usage: net_refresh + +cmd-net_graph-desc = Toggles the net statistics pannel. +cmd-net_graph-help = Usage: net_graph + +cmd-net_watchent-desc = Dumps all network updates for an EntityId to the console. +cmd-net_watchent-help = Usage: net_watchent <0|EntityUid> + +cmd-net_draw_interp-desc = Toggles the debug drawing of the network interpolation. +cmd-net_draw_interp-help = Usage: net_draw_interp <0|EntityUid> + +cmd-vram-desc = Displays video memory usage statics by the game. +cmd-vram-help = Usage: vram + +cmd-showislands-desc = Shows the current physics bodies involved in each physics island. +cmd-showislands-help = Usage: showislands + +cmd-showgridnodes-desc = Shows the nodes for grid split purposes. +cmd-showgridnodes-help = Usage: showgridnodes + +cmd-profsnap-desc = Make a profiling snapshot. +cmd-profsnap-help = Usage: profsnap + +cmd-devwindow-desc = Dev Window +cmd-devwindow-help = Usage: devwindow + +cmd-devwindow-desc = Open file +cmd-devwindow-help = Usage: testopenfile + +cmd-scene-desc = Immediately changes the UI scene/state. +cmd-scene-help = Usage: scene + +cmd-szr_stats-desc = Report serializer statistics. +cmd-szr_stats-help = Usage: szr_stats + +cmd-hwid-desc = Returns the current HWID (HardWare ID). +cmd-hwid-help = Usage: hwid + +cmd-vvread-desc = Retrieve a path's value using VV (View Variables). +cmd-vvread-desc = Usage: vvread + +cmd-vvwrite-desc = Modify a path's value using VV (View Variables). +cmd-vvwrite-desc = Usage: vvwrite + +cmd-vv-desc = Opens View Variables (VV). +cmd-vv-desc = Usage: vv + +cmd-vvinvoke-desc = Invoke/Call a path with arguments using VV. +cmd-vvinvoke-desc = Usage: vvinvoke [arguments...] diff --git a/Resources/Locale/en-US/midi-commands.ftl b/Resources/Locale/en-US/midi-commands.ftl index a8200d1026..3660977a49 100644 --- a/Resources/Locale/en-US/midi-commands.ftl +++ b/Resources/Locale/en-US/midi-commands.ftl @@ -1 +1 @@ -midi-panic-command-description = Turns off every note for every active MIDI renderer. +cmd-midipanic-desc = Turns off every note for every active MIDI renderer. diff --git a/Resources/Locale/pt-BR/midi-commands.ftl b/Resources/Locale/pt-BR/midi-commands.ftl index 9724593220..9873931c0b 100644 --- a/Resources/Locale/pt-BR/midi-commands.ftl +++ b/Resources/Locale/pt-BR/midi-commands.ftl @@ -1 +1 @@ -midi-panic-command-description = Desliga cada nota para cada renderizador MIDI ativo. +cmd-midipanic-desc = Desliga cada nota para cada renderizador MIDI ativo. diff --git a/Robust.Client/Audio/Midi/Commands/MidiPanicCommand.cs b/Robust.Client/Audio/Midi/Commands/MidiPanicCommand.cs index e0a661323d..0c31e84484 100644 --- a/Robust.Client/Audio/Midi/Commands/MidiPanicCommand.cs +++ b/Robust.Client/Audio/Midi/Commands/MidiPanicCommand.cs @@ -4,15 +4,13 @@ using Robust.Shared.Localization; namespace Robust.Client.Audio.Midi.Commands; -public sealed class MidiPanicCommand : IConsoleCommand +public sealed class MidiPanicCommand : LocalizedCommands { [Dependency] private readonly IMidiManager _midiManager = default!; - public string Command => "midipanic"; - public string Description => Loc.GetString("midi-panic-command-description"); - public string Help => $"{Command}"; + public override string Command => "midipanic"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { foreach (var renderer in _midiManager.Renderers) { diff --git a/Robust.Client/Console/ClientConsoleHost.cs b/Robust.Client/Console/ClientConsoleHost.cs index 0fbc550ac7..dc05c8063c 100644 --- a/Robust.Client/Console/ClientConsoleHost.cs +++ b/Robust.Client/Console/ClientConsoleHost.cs @@ -266,18 +266,18 @@ namespace Robust.Client.Console } } - private sealed class RemoteExecCommand : IConsoleCommand + private sealed class RemoteExecCommand : LocalizedCommands { - public string Command => ">"; - public string Description => Loc.GetString("cmd-remoteexec-desc"); - public string Help => Loc.GetString("cmd-remoteexec-help"); + public override string Command => ">"; + public override string Description => LocalizationManager.GetString("cmd-remoteexec-desc"); + public override string Help => LocalizationManager.GetString("cmd-remoteexec-help"); - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { shell.RemoteExecuteCommand(argStr["> ".Length..]); } - public async ValueTask GetCompletionAsync( + public override async ValueTask GetCompletionAsync( IConsoleShell shell, string[] args, CancellationToken cancel) diff --git a/Robust.Client/Console/Commands/AddCompCommand.cs b/Robust.Client/Console/Commands/AddCompCommand.cs index e81e8279ce..55c36c3f2b 100644 --- a/Robust.Client/Console/Commands/AddCompCommand.cs +++ b/Robust.Client/Console/Commands/AddCompCommand.cs @@ -6,13 +6,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - internal sealed class AddCompCommand : IConsoleCommand + internal sealed class AddCompCommand : LocalizedCommands { - public string Command => "addcompc"; - public string Description => "Adds a component to an entity on the client"; - public string Help => "addcompc "; + public override string Command => "addcompc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) @@ -36,13 +34,11 @@ namespace Robust.Client.Console.Commands } [UsedImplicitly] - internal sealed class RemoveCompCommand : IConsoleCommand + internal sealed class RemoveCompCommand : LocalizedCommands { - public string Command => "rmcompc"; - public string Description => "Removes a component from an entity."; - public string Help => "rmcompc "; + public override string Command => "rmcompc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { diff --git a/Robust.Client/Console/Commands/ClientSpawnCommand.cs b/Robust.Client/Console/Commands/ClientSpawnCommand.cs index 8f6e56bbae..9142e60064 100644 --- a/Robust.Client/Console/Commands/ClientSpawnCommand.cs +++ b/Robust.Client/Console/Commands/ClientSpawnCommand.cs @@ -7,13 +7,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - internal sealed class ClientSpawnCommand : IConsoleCommand + internal sealed class ClientSpawnCommand : LocalizedCommands { - public string Command => "cspawn"; - public string Description => "Spawns a client-side entity with specific type at your feet."; - public string Help => "cspawn "; + public override string Command => "cspawn"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var controlled = IoCManager.Resolve().LocalPlayer?.ControlledEntity ?? EntityUid.Invalid; if (controlled == EntityUid.Invalid) diff --git a/Robust.Client/Console/Commands/ConfigurationCommands.cs b/Robust.Client/Console/Commands/ConfigurationCommands.cs index fa7787a8d4..468a7f9f03 100644 --- a/Robust.Client/Console/Commands/ConfigurationCommands.cs +++ b/Robust.Client/Console/Commands/ConfigurationCommands.cs @@ -6,13 +6,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - public sealed class SaveConfig : IConsoleCommand + public sealed class SaveConfig : LocalizedCommands { - public string Command => "saveconfig"; - public string Description => "Saves the client configuration to the config file"; - public string Help => "saveconfig"; + public override string Command => "saveconfig"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().SaveToFile(); } diff --git a/Robust.Client/Console/Commands/ConsoleCommands.cs b/Robust.Client/Console/Commands/ConsoleCommands.cs index 82b47ca732..059416f963 100644 --- a/Robust.Client/Console/Commands/ConsoleCommands.cs +++ b/Robust.Client/Console/Commands/ConsoleCommands.cs @@ -6,25 +6,21 @@ using Robust.Shared.Console; namespace Robust.Client.Console.Commands { - sealed class ClearCommand : IConsoleCommand + sealed class ClearCommand : LocalizedCommands { - public string Command => "cls"; - public string Help => "Clears the debug console of all messages."; - public string Description => "Clears the console."; + public override string Command => "cls"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { shell.Clear(); } } - sealed class FillCommand : IConsoleCommand + sealed class FillCommand : LocalizedCommands { - public string Command => "fill"; - public string Help => "Fills the console with some nonsense for debugging."; - public string Description => "Fill up the console for debugging."; + public override string Command => "fill"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { for (int x = 0; x < 50; x++) { diff --git a/Robust.Client/Console/Commands/Debug.cs b/Robust.Client/Console/Commands/Debug.cs index 7aebea2a65..176247149c 100644 --- a/Robust.Client/Console/Commands/Debug.cs +++ b/Robust.Client/Console/Commands/Debug.cs @@ -31,30 +31,28 @@ using static Robust.Client.UserInterface.Controls.BoxContainer; namespace Robust.Client.Console.Commands { - internal sealed class DumpEntitiesCommand : IConsoleCommand + internal sealed class DumpEntitiesCommand : LocalizedCommands { - public string Command => "dumpentities"; - public string Help => "Dump entity list"; - public string Description => "Dumps entity list of UIDs and prototype."; + public override string Command => "dumpentities"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var entityManager = IoCManager.Resolve(); foreach (var e in entityManager.GetEntities().OrderBy(e => e)) { - shell.WriteLine($"entity {e}, {entityManager.GetComponent(e).EntityPrototype?.ID}, {entityManager.GetComponent(e).Coordinates}."); + shell.WriteLine( + $"entity {e}, {entityManager.GetComponent(e).EntityPrototype?.ID}, {entityManager.GetComponent(e).Coordinates}."); } } } - internal sealed class GetComponentRegistrationCommand : IConsoleCommand + internal sealed class GetComponentRegistrationCommand : LocalizedCommands { - public string Command => "getcomponentregistration"; - public string Help => "Usage: getcomponentregistration "; - public string Description => "Gets component registration information"; + public override string Command => "getcomponentregistration"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) { @@ -94,13 +92,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ToggleMonitorCommand : IConsoleCommand + internal sealed class ToggleMonitorCommand : LocalizedCommands { - public string Command => "monitor"; + public override string Command => "monitor"; - public string Description => Loc.GetString("cmd-monitor-desc"); - - public string Help + public override string Help { get { @@ -109,7 +105,7 @@ namespace Robust.Client.Console.Commands } } - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var monitors = IoCManager.Resolve().DebugMonitors; @@ -149,7 +145,7 @@ namespace Robust.Client.Console.Commands monitors.ToggleMonitor(parsedMonitor); } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { @@ -167,38 +163,32 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ExceptionCommand : IConsoleCommand + internal sealed class ExceptionCommand : LocalizedCommands { - public string Command => "fuck"; - public string Help => "Throws an exception"; - public string Description => "Throws an exception"; + public override string Command => "fuck"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { throw new InvalidOperationException("Fuck"); } } - internal sealed class ShowPositionsCommand : IConsoleCommand + internal sealed class ShowPositionsCommand : LocalizedCommands { - public string Command => "showpos"; - public string Help => ""; - public string Description => "Enables debug drawing over all entity positions in the game."; + public override string Command => "showpos"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve().GetEntitySystem(); mgr.DebugPositions = !mgr.DebugPositions; } } - internal sealed class ShowRayCommand : IConsoleCommand + internal sealed class ShowRayCommand : LocalizedCommands { - public string Command => "showrays"; - public string Help => "Usage: showrays "; - public string Description => "Toggles debug drawing of physics rays. An integer for must be provided"; + public override string Command => "showrays"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -219,28 +209,21 @@ namespace Robust.Client.Console.Commands } } - internal sealed class DisconnectCommand : IConsoleCommand + internal sealed class DisconnectCommand : LocalizedCommands { - public string Command => "disconnect"; - public string Help => ""; - public string Description => "Immediately disconnect from the server and go back to the main menu."; + public override string Command => "disconnect"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().ClientDisconnect("Disconnect command used."); } } - internal sealed class EntityInfoCommand : IConsoleCommand + internal sealed class EntityInfoCommand : LocalizedCommands { - public string Command => "entfo"; + public override string Command => "entfo"; - public string Help => - "entfo \nThe entity UID can be prefixed with 'c' to convert it to a client entity UID."; - - public string Description => "Displays verbose diagnostics for an entity."; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -261,9 +244,11 @@ namespace Robust.Client.Console.Commands shell.WriteError("That entity does not exist. Sorry lad."); return; } + var meta = entmgr.GetComponent(uid); shell.WriteLine($"{uid}: {meta.EntityPrototype?.ID}/{meta.EntityName}"); - shell.WriteLine($"init/del/lmt: {meta.EntityInitialized}/{meta.EntityDeleted}/{meta.EntityLastModifiedTick}"); + shell.WriteLine( + $"init/del/lmt: {meta.EntityInitialized}/{meta.EntityDeleted}/{meta.EntityLastModifiedTick}"); foreach (var component in entmgr.GetComponents(uid)) { shell.WriteLine(component.ToString() ?? ""); @@ -283,13 +268,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class SnapGridGetCell : IConsoleCommand + internal sealed class SnapGridGetCell : LocalizedCommands { - public string Command => "sggcell"; - public string Help => "sggcell \nThat vector2i param is in the form x,y."; - public string Description => "Lists entities on a snap grid cell."; + public override string Command => "sggcell"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { @@ -315,8 +298,8 @@ namespace Robust.Client.Console.Commands if (mapMan.TryGetGrid(gridUid, out var grid)) { foreach (var entity in grid.GetAnchoredEntities(new Vector2i( - int.Parse(indices.Split(',')[0], CultureInfo.InvariantCulture), - int.Parse(indices.Split(',')[1], CultureInfo.InvariantCulture)))) + int.Parse(indices.Split(',')[0], CultureInfo.InvariantCulture), + int.Parse(indices.Split(',')[1], CultureInfo.InvariantCulture)))) { shell.WriteLine(entity.ToString()); } @@ -328,19 +311,18 @@ namespace Robust.Client.Console.Commands } } - internal sealed class SetPlayerName : IConsoleCommand + internal sealed class SetPlayerName : LocalizedCommands { - public string Command => "overrideplayername"; - public string Description => "Changes the name used when attempting to connect to the server."; - public string Help => Command + " "; + public override string Command => "overrideplayername"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) { shell.WriteLine(Help); return; } + var client = IoCManager.Resolve(); client.PlayerNameOverride = args[0]; @@ -348,19 +330,18 @@ namespace Robust.Client.Console.Commands } } - internal sealed class LoadResource : IConsoleCommand + internal sealed class LoadResource : LocalizedCommands { - public string Command => "ldrsc"; - public string Description => "Pre-caches a resource."; - public string Help => "ldrsc "; + public override string Command => "ldrsc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) { shell.WriteLine(Help); return; } + var resourceCache = IoCManager.Resolve(); var reflection = IoCManager.Resolve(); Type type; @@ -369,7 +350,7 @@ namespace Robust.Client.Console.Commands { type = reflection.LooseGetType(args[1]); } - catch(ArgumentException) + catch (ArgumentException) { shell.WriteError("Unable to find type"); return; @@ -385,19 +366,18 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ReloadResource : IConsoleCommand + internal sealed class ReloadResource : LocalizedCommands { - public string Command => "rldrsc"; - public string Description => "Reloads a resource."; - public string Help => "rldrsc "; + public override string Command => "rldrsc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) { shell.WriteLine(Help); return; } + var resourceCache = IoCManager.Resolve(); var reflection = IoCManager.Resolve(); @@ -406,7 +386,7 @@ namespace Robust.Client.Console.Commands { type = reflection.LooseGetType(args[1]); } - catch(ArgumentException) + catch (ArgumentException) { shell.WriteError("Unable to find type"); return; @@ -419,13 +399,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class GridTileCount : IConsoleCommand + internal sealed class GridTileCount : LocalizedCommands { - public string Command => "gridtc"; - public string Description => "Gets the tile count of a grid"; - public string Help => "Usage: gridtc "; + public override string Command => "gridtc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -451,13 +429,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class GuiDumpCommand : IConsoleCommand + internal sealed class GuiDumpCommand : LocalizedCommands { - public string Command => "guidump"; - public string Description => "Dump GUI tree to /guidump.txt in user data."; - public string Help => "guidump"; + public override string Command => "guidump"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var uiMgr = IoCManager.Resolve(); var res = IoCManager.Resolve(); @@ -525,15 +501,13 @@ namespace Robust.Client.Console.Commands } } - internal sealed class UITestCommand : IConsoleCommand + internal sealed class UITestCommand : LocalizedCommands { - public string Command => "uitest"; - public string Description => "Open a dummy UI testing window"; - public string Help => "uitest"; + public override string Command => "uitest"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var window = new DefaultWindow { MinSize = (500, 400)}; + var window = new DefaultWindow { MinSize = (500, 400) }; var tabContainer = new TabContainer(); window.Contents.AddChild(tabContainer); var scroll = new ScrollContainer(); @@ -636,18 +610,18 @@ namespace Robust.Client.Console.Commands { new PanelContainer { - PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Red}, + PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Red }, Children = { - new Label{ Text = "FOOBARBAZ"}, + new Label { Text = "FOOBARBAZ" }, } }, new PanelContainer { - PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Blue}, + PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Blue }, Children = { - new Label{ Text = "FOOBARBAZ"}, + new Label { Text = "FOOBARBAZ" }, } }, } @@ -657,39 +631,33 @@ namespace Robust.Client.Console.Commands } } - internal sealed class SetClipboardCommand : IConsoleCommand + internal sealed class SetClipboardCommand : LocalizedCommands { - public string Command => "setclipboard"; - public string Description => "Sets the system clipboard"; - public string Help => "setclipboard "; + public override string Command => "setclipboard"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); mgr.SetText(args[0]); } } - internal sealed class GetClipboardCommand : IConsoleCommand + internal sealed class GetClipboardCommand : LocalizedCommands { - public string Command => "getclipboard"; - public string Description => "Gets the system clipboard"; - public string Help => "getclipboard"; + public override string Command => "getclipboard"; - public async void Execute(IConsoleShell shell, string argStr, string[] args) + public override async void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); shell.WriteLine(await mgr.GetText()); } } - internal sealed class ToggleLight : IConsoleCommand + internal sealed class ToggleLight : LocalizedCommands { - public string Command => "togglelight"; - public string Description => "Toggles light rendering."; - public string Help => "togglelight"; + public override string Command => "togglelight"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); if (!mgr.LockConsoleAccess) @@ -697,27 +665,23 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ToggleFOV : IConsoleCommand + internal sealed class ToggleFOV : LocalizedCommands { - public string Command => "togglefov"; - public string Description => "Toggles fov for client."; - public string Help => "togglefov"; + public override string Command => "togglefov"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var mgr = IoCManager.Resolve(); - if (mgr.CurrentEye != null) - mgr.CurrentEye.DrawFov = !mgr.CurrentEye.DrawFov; + var mgr = IoCManager.Resolve(); + if (mgr.CurrentEye != null) + mgr.CurrentEye.DrawFov = !mgr.CurrentEye.DrawFov; } } - internal sealed class ToggleHardFOV : IConsoleCommand + internal sealed class ToggleHardFOV : LocalizedCommands { - public string Command => "togglehardfov"; - public string Description => "Toggles hard fov for client (for debugging space-station-14#2353)."; - public string Help => "togglehardfov"; + public override string Command => "togglehardfov"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); if (!mgr.LockConsoleAccess) @@ -725,26 +689,23 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ToggleShadows : IConsoleCommand + internal sealed class ToggleShadows : LocalizedCommands { - public string Command => "toggleshadows"; - public string Description => "Toggles shadow rendering."; - public string Help => "toggleshadows"; + public override string Command => "toggleshadows"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); if (!mgr.LockConsoleAccess) mgr.DrawShadows = !mgr.DrawShadows; } } - internal sealed class ToggleLightBuf : IConsoleCommand - { - public string Command => "togglelightbuf"; - public string Description => "Toggles lighting rendering. This includes shadows but not FOV."; - public string Help => "togglelightbuf"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + internal sealed class ToggleLightBuf : LocalizedCommands + { + public override string Command => "togglelightbuf"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); if (!mgr.LockConsoleAccess) @@ -752,13 +713,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ChunkInfoCommand : IConsoleCommand + internal sealed class ChunkInfoCommand : LocalizedCommands { - public string Command => "chunkinfo"; - public string Description => "Gets info about a chunk under your mouse cursor."; - public string Help => Command; + public override string Command => "chunkinfo"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mapMan = IoCManager.Resolve(); var inputMan = IoCManager.Resolve(); @@ -781,20 +740,15 @@ namespace Robust.Client.Console.Commands } } - internal sealed class ReloadShadersCommand : IConsoleCommand + internal sealed class ReloadShadersCommand : LocalizedCommands { - - public string Command => "rldshader"; - - public string Description => "Reloads all shaders"; - - public string Help => "rldshader"; + public override string Command => "rldshader"; public static Dictionary? _watchers; public static ConcurrentDictionary? _reloadShadersQueued = new(); - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IResourceCacheInternal resC; if (args.Length == 1) @@ -806,12 +760,14 @@ namespace Robust.Client.Console.Commands shell.WriteLine("Already watching."); return; } + resC = IoCManager.Resolve(); _watchers = new Dictionary(); var stringComparer = PathHelpers.IsFileSystemCaseSensitive() - ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase; + ? StringComparer.Ordinal + : StringComparer.OrdinalIgnoreCase; var reversePathResolution = new ConcurrentDictionary>(stringComparer); @@ -949,16 +905,13 @@ namespace Robust.Client.Console.Commands shell.WriteLine("Done."); } - } - internal sealed class ClydeDebugLayerCommand : IConsoleCommand + internal sealed class ClydeDebugLayerCommand : LocalizedCommands { - public string Command => "cldbglyr"; - public string Description => "Toggle fov and light debug layers"; - public string Help => "cldbglyr : Toggle \ncldbglyr: Turn all Layers off"; + public override string Command => "cldbglyr"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var clyde = IoCManager.Resolve(); @@ -977,13 +930,11 @@ namespace Robust.Client.Console.Commands } } - internal sealed class GetKeyInfoCommand : IConsoleCommand + internal sealed class GetKeyInfoCommand : LocalizedCommands { - public string Command => "keyinfo"; - public string Description => "Keys key info for a key"; - public string Help => "keyinfo "; + public override string Command => "keyinfo"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -995,7 +946,7 @@ namespace Robust.Client.Console.Commands if (Enum.TryParse(typeof(Keyboard.Key), args[0], true, out var parsed)) { - var key = (Keyboard.Key) parsed!; + var key = (Keyboard.Key)parsed!; var name = clyde.GetKeyName(key); diff --git a/Robust.Client/Console/Commands/DebugAnchoredCommand.cs b/Robust.Client/Console/Commands/DebugAnchoredCommand.cs index 103af0aff8..8a1e2119c4 100644 --- a/Robust.Client/Console/Commands/DebugAnchoredCommand.cs +++ b/Robust.Client/Console/Commands/DebugAnchoredCommand.cs @@ -5,12 +5,11 @@ using Robust.Shared.GameObjects; namespace Robust.Client.Console.Commands { - public sealed class DebugAnchoredCommand : IConsoleCommand + public sealed class DebugAnchoredCommand : LocalizedCommands { - public string Command => "showanchored"; - public string Description => $"Shows anchored entities on a particular tile"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "showanchored"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntitySystem.Get().Enabled ^= true; } diff --git a/Robust.Client/Console/Commands/DumpMetadataMembersCommand.cs b/Robust.Client/Console/Commands/DumpMetadataMembersCommand.cs index 0d757ca771..724e2d71d4 100644 --- a/Robust.Client/Console/Commands/DumpMetadataMembersCommand.cs +++ b/Robust.Client/Console/Commands/DumpMetadataMembersCommand.cs @@ -5,13 +5,11 @@ using Robust.Shared.ContentPack; namespace Robust.Client.Console.Commands { #if DEBUG - internal sealed class DumpMetadataMembersCommand : IConsoleCommand + internal sealed class DumpMetadataMembersCommand : LocalizedCommands { - public string Command => "dmetamem"; - public string Description => "Dumps a type's members in a format suitable for the sandbox configuration file."; - public string Help => "Usage: dmetamem "; + public override string Command => "dmetamem"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var type = Type.GetType(args[0]); diff --git a/Robust.Client/Console/Commands/GridChunkBBCommand.cs b/Robust.Client/Console/Commands/GridChunkBBCommand.cs index f01a2289b9..2b14097c30 100644 --- a/Robust.Client/Console/Commands/GridChunkBBCommand.cs +++ b/Robust.Client/Console/Commands/GridChunkBBCommand.cs @@ -4,12 +4,11 @@ using Robust.Shared.GameObjects; namespace Robust.Client.Console.Commands { - public sealed class GridChunkBBCommand : IConsoleCommand + public sealed class GridChunkBBCommand : LocalizedCommands { - public string Command => "showchunkbb"; - public string Description => "Displays chunk bounds for the purposes of rendering"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "showchunkbb"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntitySystem.Get().Enabled ^= true; } diff --git a/Robust.Client/Console/Commands/LauncherAuthCommand.cs b/Robust.Client/Console/Commands/LauncherAuthCommand.cs index 72d0e7492b..1a59f2466c 100644 --- a/Robust.Client/Console/Commands/LauncherAuthCommand.cs +++ b/Robust.Client/Console/Commands/LauncherAuthCommand.cs @@ -9,13 +9,11 @@ using Robust.Shared.Network; namespace Robust.Client.Console.Commands { - internal sealed class LauncherAuthCommand : IConsoleCommand + internal sealed class LauncherAuthCommand : LocalizedCommands { - public string Command => "launchauth"; - public string Description => "Load authentication tokens from launcher data to aid in testing of live servers"; - public string Help => "launchauth [account name]"; + public override string Command => "launchauth"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var wantName = args.Length > 0 ? args[0] : null; diff --git a/Robust.Client/Console/Commands/LightBBCommand.cs b/Robust.Client/Console/Commands/LightBBCommand.cs index d433241072..107f8146de 100644 --- a/Robust.Client/Console/Commands/LightBBCommand.cs +++ b/Robust.Client/Console/Commands/LightBBCommand.cs @@ -5,12 +5,11 @@ using Robust.Shared.GameObjects; namespace Robust.Client.Console.Commands { - internal sealed class LightDebugCommand : IConsoleCommand + internal sealed class LightDebugCommand : LocalizedCommands { - public string Command => "lightbb"; - public string Description => "Toggles whether to show light bounding boxes"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "lightbb"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntitySystem.Get().Enabled ^= true; } diff --git a/Robust.Client/Console/Commands/MonitorCommands.cs b/Robust.Client/Console/Commands/MonitorCommands.cs index 9d823cd75a..3757299aaa 100644 --- a/Robust.Client/Console/Commands/MonitorCommands.cs +++ b/Robust.Client/Console/Commands/MonitorCommands.cs @@ -7,13 +7,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - public sealed class LsMonitorCommand : IConsoleCommand + public sealed class LsMonitorCommand : LocalizedCommands { - public string Command => "lsmonitor"; - public string Description => ""; - public string Help => ""; + public override string Command => "lsmonitor"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var clyde = IoCManager.Resolve(); @@ -26,13 +24,11 @@ namespace Robust.Client.Console.Commands } [UsedImplicitly] - public sealed class MonitorInfoCommand : IConsoleCommand + public sealed class MonitorInfoCommand : LocalizedCommands { - public string Command => "monitorinfo"; - public string Description => ""; - public string Help => "Usage: monitorinfo "; + public override string Command => "monitorinfo"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) { @@ -54,13 +50,11 @@ namespace Robust.Client.Console.Commands } [UsedImplicitly] - public sealed class SetMonitorCommand : IConsoleCommand + public sealed class SetMonitorCommand : LocalizedCommands { - public string Command => "setmonitor"; - public string Description => ""; - public string Help => "Usage: setmonitor "; + public override string Command => "setmonitor"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var clyde = IoCManager.Resolve(); diff --git a/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs b/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs index efbd576936..e9300b50c2 100644 --- a/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs +++ b/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs @@ -6,13 +6,11 @@ using Robust.Shared.Localization; namespace Robust.Client.Console.Commands { - public sealed class PhysicsOverlayCommands : IConsoleCommand + public sealed class PhysicsOverlayCommands : LocalizedCommands { - public string Command => "physics"; - public string Description => $"Shows a debug physics overlay. The arg supplied specifies the overlay."; - public string Help => $"{Command} "; + public override string Command => "physics"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -56,7 +54,7 @@ namespace Robust.Client.Console.Commands return; } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length != 1) return CompletionResult.Empty; diff --git a/Robust.Client/Console/Commands/QuitCommand.cs b/Robust.Client/Console/Commands/QuitCommand.cs index 8b25d515b2..e4711d7764 100644 --- a/Robust.Client/Console/Commands/QuitCommand.cs +++ b/Robust.Client/Console/Commands/QuitCommand.cs @@ -4,25 +4,21 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - sealed class HardQuitCommand : IConsoleCommand + sealed class HardQuitCommand : LocalizedCommands { - public string Command => "hardquit"; - public string Description => "Kills the game client instantly."; - public string Help => "Kills the game client instantly, leaving no traces. No telling the server goodbye"; + public override string Command => "hardquit"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { Environment.Exit(0); } } - sealed class QuitCommand : IConsoleCommand + sealed class QuitCommand : LocalizedCommands { - public string Command => "quit"; - public string Description => "Shuts down the game client gracefully."; - public string Help => "Properly shuts down the game client, notifying the connected server and such."; + public override string Command => "quit"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().Shutdown("quit command used"); } diff --git a/Robust.Client/Console/Commands/ReloadLocalizationsCommand.cs b/Robust.Client/Console/Commands/ReloadLocalizationsCommand.cs index c7984689f2..cb0f566740 100644 --- a/Robust.Client/Console/Commands/ReloadLocalizationsCommand.cs +++ b/Robust.Client/Console/Commands/ReloadLocalizationsCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Client.Console.Commands { - internal sealed class ReloadLocalizationsCommand : IConsoleCommand + internal sealed class ReloadLocalizationsCommand : LocalizedCommands { - public string Command => "rldloc"; - public string Description => "Reloads localization (client & server)"; - public string Help => "Usage: rldloc"; + public override string Command => "rldloc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().ReloadLocalizations(); diff --git a/Robust.Client/Console/Commands/Scripting.cs b/Robust.Client/Console/Commands/Scripting.cs index d52ae321bf..34d93d0271 100644 --- a/Robust.Client/Console/Commands/Scripting.cs +++ b/Robust.Client/Console/Commands/Scripting.cs @@ -4,38 +4,32 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { #if CLIENT_SCRIPTING - internal sealed class ScriptCommand : IConsoleCommand + internal sealed class ScriptCommand : LocalizedCommands { - public string Command => "csi"; - public string Description => "Opens a C# interactive console."; - public string Help => "csi"; + public override string Command => "csi"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { new ScriptConsoleClient().OpenCentered(); } } - internal sealed class WatchCommand : IConsoleCommand + internal sealed class WatchCommand : LocalizedCommands { - public string Command => "watch"; - public string Description => "Opens a variable watch window."; - public string Help => "watch"; + public override string Command => "watch"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { new WatchWindow().OpenCentered(); } } #endif - internal sealed class ServerScriptCommand : IConsoleCommand + internal sealed class ServerScriptCommand : LocalizedCommands { - public string Command => "scsi"; - public string Description => "Opens a C# interactive console on the server."; - public string Help => "scsi"; + public override string Command => "scsi"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); if (!mgr.CanScript) diff --git a/Robust.Client/Console/Commands/SendGarbageCommand.cs b/Robust.Client/Console/Commands/SendGarbageCommand.cs index fd14a6cc91..41a253467d 100644 --- a/Robust.Client/Console/Commands/SendGarbageCommand.cs +++ b/Robust.Client/Console/Commands/SendGarbageCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Network; namespace Robust.Client.Console.Commands { - internal sealed class SendGarbageCommand : IConsoleCommand + internal sealed class SendGarbageCommand : LocalizedCommands { - public string Command => "sendgarbage"; - public string Description => "Sends garbage to the server."; - public string Help => "The server will reply with 'no u'"; + public override string Command => "sendgarbage"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { // MsgStringTableEntries is registered as NetMessageAccept.Client so the server will immediately deny it. // And kick us. diff --git a/Robust.Client/Console/Commands/SetInputContextCommand.cs b/Robust.Client/Console/Commands/SetInputContextCommand.cs index 49c586ae1a..2ecadafa26 100644 --- a/Robust.Client/Console/Commands/SetInputContextCommand.cs +++ b/Robust.Client/Console/Commands/SetInputContextCommand.cs @@ -6,13 +6,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { [UsedImplicitly] - public sealed class SetInputContextCommand : IConsoleCommand + public sealed class SetInputContextCommand : LocalizedCommands { - public string Command => "setinputcontext"; - public string Description => "Sets the active input context."; - public string Help => "setinputcontext "; + public override string Command => "setinputcontext"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { diff --git a/Robust.Client/Console/Commands/VelocitiesCommand.cs b/Robust.Client/Console/Commands/VelocitiesCommand.cs index 79e50a30cb..a32ec63595 100644 --- a/Robust.Client/Console/Commands/VelocitiesCommand.cs +++ b/Robust.Client/Console/Commands/VelocitiesCommand.cs @@ -5,12 +5,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Console.Commands { - public sealed class VelocitiesCommand : IConsoleCommand + public sealed class VelocitiesCommand : LocalizedCommands { - public string Command => "showvelocities"; - public string Description => "Displays your angular and linear velocities"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "showvelocities"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().GetEntitySystem().Enabled ^= true; } diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs index 609bdef1fd..3f10cdce87 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteBoundsOverlay.cs @@ -10,12 +10,11 @@ using Robust.Shared.Utility; namespace Robust.Client.GameObjects { - public sealed class ShowSpriteBBCommand : IConsoleCommand + public sealed class ShowSpriteBBCommand : LocalizedCommands { - public string Command => "showspritebb"; - public string Description => "Toggle whether sprite bounds are shown"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "showspritebb"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntitySystem.Get().Enabled ^= true; } diff --git a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs index 99332f90e1..ddac0309cf 100644 --- a/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/DebugEntityLookupSystem.cs @@ -12,12 +12,11 @@ using Color = Robust.Shared.Maths.Color; namespace Robust.Client.GameObjects; -public sealed class DebugEntityLookupCommand : IConsoleCommand +public sealed class DebugEntityLookupCommand : LocalizedCommands { - public string Command => "togglelookup"; - public string Description => "Shows / hides entitylookup bounds via an overlay"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "togglelookup"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntitySystem.Get().Enabled ^= true; } diff --git a/Robust.Client/GameStates/NetEntityOverlay.cs b/Robust.Client/GameStates/NetEntityOverlay.cs index 63ee9f4768..630bb6090f 100644 --- a/Robust.Client/GameStates/NetEntityOverlay.cs +++ b/Robust.Client/GameStates/NetEntityOverlay.cs @@ -27,7 +27,7 @@ namespace Robust.Client.GameStates [Dependency] private readonly IEntityManager _entityManager = default!; private const uint TrafficHistorySize = 64; // Size of the traffic history bar in game ticks. - private const int _maxEnts = 128; // maximum number of entities to track. + private const int _maxEnts = 128; // maximum number of entities to track. /// public override OverlaySpace Space => OverlaySpace.ScreenSpace; @@ -51,7 +51,7 @@ namespace Robust.Client.GameStates { if (msg.Tick.Value + TrafficHistorySize < _gameTiming.LastRealTick.Value) return; - + foreach (var uid in msg.Entities) { if (!_netEnts.TryGetValue(uid, out var netEnt)) @@ -197,13 +197,11 @@ namespace Robust.Client.GameStates } } - private sealed class NetEntityReportCommand : IConsoleCommand + private sealed class NetEntityReportCommand : LocalizedCommands { - public string Command => "net_entityreport"; - public string Help => "net_entityreport"; - public string Description => "Toggles the net entity report panel."; + public override string Command => "net_entityreport"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var overlayMan = IoCManager.Resolve(); @@ -220,14 +218,12 @@ namespace Robust.Client.GameStates } } - private sealed class NetShowGraphCommand : IConsoleCommand + private sealed class NetShowGraphCommand : LocalizedCommands { // Yeah commands should be localized, but I'm lazy and this is really just a debug command. - public string Command => "net_refresh"; - public string Help => "net_refresh"; - public string Description => "requests a full server state"; + public override string Command => "net_refresh"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().RequestFullState(); } diff --git a/Robust.Client/GameStates/NetGraphOverlay.cs b/Robust.Client/GameStates/NetGraphOverlay.cs index 0b5c7302d7..af1030ff58 100644 --- a/Robust.Client/GameStates/NetGraphOverlay.cs +++ b/Robust.Client/GameStates/NetGraphOverlay.cs @@ -251,13 +251,11 @@ namespace Robust.Client.GameStates base.DisposeBehavior(); } - private sealed class NetShowGraphCommand : IConsoleCommand + private sealed class NetShowGraphCommand : LocalizedCommands { - public string Command => "net_graph"; - public string Help => "net_graph"; - public string Description => "Toggles the net statistics pannel."; + public override string Command => "net_graph"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var overlayMan = IoCManager.Resolve(); @@ -274,13 +272,11 @@ namespace Robust.Client.GameStates } } - private sealed class NetWatchEntCommand : IConsoleCommand + private sealed class NetWatchEntCommand : LocalizedCommands { - public string Command => "net_watchent"; - public string Help => "net_watchent <0|EntityUid>"; - public string Description => "Dumps all network updates for an EntityId to the console."; + public override string Command => "net_watchent"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { EntityUid eValue; if (args.Length == 0) diff --git a/Robust.Client/GameStates/NetInterpOverlay.cs b/Robust.Client/GameStates/NetInterpOverlay.cs index 2a48a04a7c..23fcd2a5c6 100644 --- a/Robust.Client/GameStates/NetInterpOverlay.cs +++ b/Robust.Client/GameStates/NetInterpOverlay.cs @@ -64,13 +64,11 @@ namespace Robust.Client.GameStates } } - private sealed class NetShowInterpCommand : IConsoleCommand + private sealed class NetShowInterpCommand : LocalizedCommands { - public string Command => "net_draw_interp"; - public string Help => "net_draw_interp"; - public string Description => "Toggles the debug drawing of the network interpolation."; + public override string Command => "net_draw_interp"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var overlayMan = IoCManager.Resolve(); diff --git a/Robust.Client/Graphics/Clyde/VramCommand.cs b/Robust.Client/Graphics/Clyde/VramCommand.cs index 110a7a8003..b52dff0cfb 100644 --- a/Robust.Client/Graphics/Clyde/VramCommand.cs +++ b/Robust.Client/Graphics/Clyde/VramCommand.cs @@ -11,13 +11,11 @@ using static TerraFX.Interop.DirectX.DXGI; namespace Robust.Client.Graphics.Clyde { - public sealed class VramCommand : IConsoleCommand + public sealed class VramCommand : LocalizedCommands { - public string Command => "vram"; - public string Description => "Displays video memory usage statics by the game."; - public string Help => "Usage: vram"; + public override string Command => "vram"; - public unsafe void Execute(IConsoleShell shell, string argStr, string[] args) + public override unsafe void Execute(IConsoleShell shell, string argStr, string[] args) { if (!OperatingSystem.IsWindows()) { diff --git a/Robust.Client/Input/InputManager.cs b/Robust.Client/Input/InputManager.cs index 975abf238c..9f59789715 100644 --- a/Robust.Client/Input/InputManager.cs +++ b/Robust.Client/Input/InputManager.cs @@ -907,13 +907,11 @@ namespace Robust.Client.Input } [UsedImplicitly] - internal sealed class BindCommand : IConsoleCommand + internal sealed class BindCommand : LocalizedCommands { - public string Command => "bind"; - public string Description => "Binds an input key to an input command."; - public string Help => "bind "; + public override string Command => "bind"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 3) { @@ -961,13 +959,11 @@ namespace Robust.Client.Input } [UsedImplicitly] - internal sealed class SaveBindCommand : IConsoleCommand + internal sealed class SaveBindCommand : LocalizedCommands { - public string Command => "svbind"; - public string Description => ""; - public string Help => ""; + public override string Command => "svbind"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve() .SaveToUserData(); diff --git a/Robust.Client/Physics/DebugPhysicsIslandSystem.cs b/Robust.Client/Physics/DebugPhysicsIslandSystem.cs index 5185cd6854..7848c50ce8 100644 --- a/Robust.Client/Physics/DebugPhysicsIslandSystem.cs +++ b/Robust.Client/Physics/DebugPhysicsIslandSystem.cs @@ -11,12 +11,11 @@ using Robust.Shared.Timing; namespace Robust.Client.Physics { - internal sealed class PhysicsIslandCommand : IConsoleCommand + internal sealed class PhysicsIslandCommand : LocalizedCommands { - public string Command => "showislands"; - public string Description => "Shows the current physics bodies involved in each physics island."; - public string Help => "showislands"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "showislands"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 0) { diff --git a/Robust.Client/Physics/GridSplitVisualsCommand.cs b/Robust.Client/Physics/GridSplitVisualsCommand.cs index 13d23b5be7..0f68081063 100644 --- a/Robust.Client/Physics/GridSplitVisualsCommand.cs +++ b/Robust.Client/Physics/GridSplitVisualsCommand.cs @@ -4,12 +4,11 @@ using Robust.Shared.IoC; namespace Robust.Client.Physics; -public sealed class GridSplitVisualCommand : IConsoleCommand +public sealed class GridSplitVisualCommand : LocalizedCommands { - public string Command => SharedGridFixtureSystem.ShowGridNodesCommand; - public string Description => "Shows the nodes for grid split purposes"; - public string Help => $"{Command}"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => SharedGridFixtureSystem.ShowGridNodesCommand; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var system = IoCManager.Resolve().GetEntitySystem(); system.EnableDebug ^= true; diff --git a/Robust.Client/Profiling/ProfViewManager.cs b/Robust.Client/Profiling/ProfViewManager.cs index 81c01732a3..8c72a83824 100644 --- a/Robust.Client/Profiling/ProfViewManager.cs +++ b/Robust.Client/Profiling/ProfViewManager.cs @@ -121,14 +121,12 @@ public sealed class ProfViewManager } } -public sealed class ProfSnapshotCommand : IConsoleCommand +public sealed class ProfSnapshotCommand : LocalizedCommands { // ReSharper disable once StringLiteralTypo - public string Command => "profsnap"; - public string Description => "Make a profiling snapshot"; - public string Help => ""; + public override string Command => "profsnap"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var profViewManager = IoCManager.Resolve(); profViewManager.Snap(); diff --git a/Robust.Client/UserInterface/DevWindow/DevWindow.xaml.cs b/Robust.Client/UserInterface/DevWindow/DevWindow.xaml.cs index d8300888fa..2a6ea991df 100644 --- a/Robust.Client/UserInterface/DevWindow/DevWindow.xaml.cs +++ b/Robust.Client/UserInterface/DevWindow/DevWindow.xaml.cs @@ -28,13 +28,11 @@ namespace Robust.Client.UserInterface } [UsedImplicitly] - internal sealed class TestWindowCommand : IConsoleCommand + internal sealed class TestWindowCommand : LocalizedCommands { - public string Command => "devwindow"; - public string Description => "A"; - public string Help => "A"; + public override string Command => "devwindow"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var clyde = IoCManager.Resolve(); var monitor = clyde.EnumerateMonitors().First(); diff --git a/Robust.Client/UserInterface/FileDialogManager.cs b/Robust.Client/UserInterface/FileDialogManager.cs index 90be7ab5da..095e8b3472 100644 --- a/Robust.Client/UserInterface/FileDialogManager.cs +++ b/Robust.Client/UserInterface/FileDialogManager.cs @@ -388,13 +388,11 @@ namespace Robust.Client.UserInterface } } - public sealed class OpenFileCommand : IConsoleCommand + public sealed class OpenFileCommand : LocalizedCommands { - public string Command => "testopenfile"; - public string Description => ""; - public string Help => ""; + public override string Command => "testopenfile"; - public async void Execute(IConsoleShell shell, string argStr, string[] args) + public override async void Execute(IConsoleShell shell, string argStr, string[] args) { var stream = await IoCManager.Resolve().OpenFile(); stream?.Dispose(); diff --git a/Robust.Client/UserInterface/UiCommands.cs b/Robust.Client/UserInterface/UiCommands.cs index 90eb6f5c57..e12081b0f2 100644 --- a/Robust.Client/UserInterface/UiCommands.cs +++ b/Robust.Client/UserInterface/UiCommands.cs @@ -5,13 +5,10 @@ using Robust.Shared.Reflection; namespace Robust.Client.UserInterface { - sealed class ChangeSceneCommpand : IConsoleCommand + sealed class ChangeSceneCommpand : LocalizedCommands { - public string Command => "scene"; - public string Help => "scene "; - public string Description => "Immediately changes the UI scene/state."; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "scene"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var reflection = IoCManager.Resolve(); var types = reflection.GetAllChildren(typeof(State.State)); diff --git a/Robust.Client/ViewVariables/ViewVariablesCommand.cs b/Robust.Client/ViewVariables/ViewVariablesCommand.cs index a56cc4596e..479bc3cec0 100644 --- a/Robust.Client/ViewVariables/ViewVariablesCommand.cs +++ b/Robust.Client/ViewVariables/ViewVariablesCommand.cs @@ -9,13 +9,11 @@ using Robust.Shared.ViewVariables.Commands; namespace Robust.Client.ViewVariables { [UsedImplicitly] - public sealed class ViewVariablesCommand : ViewVariablesBaseCommand, IConsoleCommand + public sealed class ViewVariablesCommand : ViewVariablesBaseCommand { [Dependency] private readonly IClientViewVariablesManager _cvvm = default!; public override string Command => "vv"; - public override string Description => "Opens View Variables."; - public override string Help => "Usage: vv "; public override void Execute(IConsoleShell shell, string argStr, string[] args) { diff --git a/Robust.Server/Bql/ForAllCommand.cs b/Robust.Server/Bql/ForAllCommand.cs index 18daa46017..10f11c2053 100644 --- a/Robust.Server/Bql/ForAllCommand.cs +++ b/Robust.Server/Bql/ForAllCommand.cs @@ -7,13 +7,11 @@ using Robust.Shared.IoC; namespace Robust.Server.Bql { - public sealed class ForAllCommand : IConsoleCommand + public sealed class ForAllCommand : LocalizedCommands { - public string Command => "forall"; - public string Description => "Runs a command over all entities with a given component"; - public string Help => "Usage: forall do "; + public override string Command => "forall"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) { diff --git a/Robust.Server/Console/Commands/AddComponentCommand.cs b/Robust.Server/Console/Commands/AddComponentCommand.cs index 83ff0ec128..0411d9c03c 100644 --- a/Robust.Server/Console/Commands/AddComponentCommand.cs +++ b/Robust.Server/Console/Commands/AddComponentCommand.cs @@ -7,13 +7,11 @@ using Robust.Shared.IoC; namespace Robust.Server.Console.Commands { [UsedImplicitly] - internal sealed class AddComponentCommand : IConsoleCommand + internal sealed class AddComponentCommand : LocalizedCommands { - public string Command => "addcomp"; - public string Description => "Adds a component to an entity"; - public string Help => $"{Command} "; + public override string Command => "addcomp"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { diff --git a/Robust.Server/Console/Commands/DeleteCommand.cs b/Robust.Server/Console/Commands/DeleteCommand.cs index 66e7b046a4..077256daca 100644 --- a/Robust.Server/Console/Commands/DeleteCommand.cs +++ b/Robust.Server/Console/Commands/DeleteCommand.cs @@ -5,13 +5,11 @@ using Robust.Shared.IoC; namespace Robust.Server.Console.Commands { - public sealed class DeleteCommand : IConsoleCommand + public sealed class DeleteCommand : LocalizedCommands { - public string Command => "delete"; - public string Description => "Deletes the entity with the specified ID."; - public string Help => "delete "; + public override string Command => "delete"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { diff --git a/Robust.Server/Console/Commands/MapCommands.cs b/Robust.Server/Console/Commands/MapCommands.cs index caf6c7c112..ed7967afc6 100644 --- a/Robust.Server/Console/Commands/MapCommands.cs +++ b/Robust.Server/Console/Commands/MapCommands.cs @@ -13,16 +13,11 @@ using Robust.Shared.Maths; namespace Robust.Server.Console.Commands { - sealed class AddMapCommand : IConsoleCommand + sealed class AddMapCommand : LocalizedCommands { - public string Command => "addmap"; + public override string Command => "addmap"; - public string Description => - "Adds a new empty map to the round. If the mapID already exists, this command does nothing."; - - public string Help => "addmap [initialize]"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) return; @@ -47,13 +42,11 @@ namespace Robust.Server.Console.Commands } } - sealed class RemoveMapCommand : IConsoleCommand + sealed class RemoveMapCommand : LocalizedCommands { - public string Command => "rmmap"; - public string Description => "Removes a map from the world. You cannot remove nullspace."; - public string Help => "rmmap "; + public override string Command => "rmmap"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -75,13 +68,11 @@ namespace Robust.Server.Console.Commands } } - public sealed class SaveGridCommand : IConsoleCommand + public sealed class SaveGridCommand : LocalizedCommands { - public string Command => "savegrid"; - public string Description => "Serializes a grid to disk."; - public string Help => "savegrid "; + public override string Command => "savegrid"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) { @@ -108,7 +99,7 @@ namespace Robust.Server.Console.Commands shell.WriteLine("Save successful. Look in the user data directory."); } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { switch (args.Length) { @@ -123,13 +114,11 @@ namespace Robust.Server.Console.Commands } } - public sealed class LoadGridCommand : IConsoleCommand + public sealed class LoadGridCommand : LocalizedCommands { - public string Command => "loadgrid"; - public string Description => "Loads a grid from a file into an existing map."; - public string Help => "loadgrid [x y] [rotation] [storeUids]"; + public override string Command => "loadgrid"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2 || args.Length == 3 || args.Length > 6) { @@ -203,19 +192,17 @@ namespace Robust.Server.Console.Commands mapLoader.LoadGrid(mapId, args[1], loadOptions); } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { return LoadMap.GetCompletionResult(shell, args); } } - public sealed class SaveMap : IConsoleCommand + public sealed class SaveMap : LocalizedCommands { - public string Command => "savemap"; - public string Description => Loc.GetString("cmd-savemap-desc"); - public string Help => Loc.GetString("cmd-savemap-help"); + public override string Command => "savemap"; - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { switch (args.Length) { @@ -231,7 +218,7 @@ namespace Robust.Server.Console.Commands return CompletionResult.Empty; } - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) { @@ -271,11 +258,9 @@ namespace Robust.Server.Console.Commands } } - public sealed class LoadMap : IConsoleCommand + public sealed class LoadMap : LocalizedCommands { - public string Command => "loadmap"; - public string Description => Loc.GetString("cmd-loadmap-desc"); - public string Help => Loc.GetString("cmd-loadmap-help"); + public override string Command => "loadmap"; public static CompletionResult GetCompletionResult(IConsoleShell shell, string[] args) { @@ -301,12 +286,12 @@ namespace Robust.Server.Console.Commands return CompletionResult.Empty; } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { return GetCompletionResult(shell, args); } - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2 || args.Length > 6) { @@ -391,13 +376,11 @@ namespace Robust.Server.Console.Commands } } - sealed class LocationCommand : IConsoleCommand + sealed class LocationCommand : LocalizedCommands { - public string Command => "loc"; - public string Description => "Prints the absolute location of the player's entity to console."; - public string Help => "loc"; + public override string Command => "loc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var player = shell.Player as IPlayerSession; var pt = player?.AttachedEntityTransform; @@ -412,13 +395,11 @@ namespace Robust.Server.Console.Commands } } - sealed class TpGridCommand : IConsoleCommand + sealed class TpGridCommand : LocalizedCommands { - public string Command => "tpgrid"; - public string Description => "Teleports a grid to a new location."; - public string Help => "tpgrid []"; + public override string Command => "tpgrid"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 3 || args.Length > 4) { @@ -445,13 +426,11 @@ namespace Robust.Server.Console.Commands } } - sealed class RemoveGridCommand : IConsoleCommand + sealed class RemoveGridCommand : LocalizedCommands { - public string Command => "rmgrid"; - public string Description => "Removes a grid from a map. You cannot remove the default grid."; - public string Help => "rmgrid "; + public override string Command => "rmgrid"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -473,13 +452,11 @@ namespace Robust.Server.Console.Commands } } - internal sealed class RunMapInitCommand : IConsoleCommand + internal sealed class RunMapInitCommand : LocalizedCommands { - public string Command => "mapinit"; - public string Description => "Runs map init on a map"; - public string Help => "mapinit "; + public override string Command => "mapinit"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { @@ -508,13 +485,11 @@ namespace Robust.Server.Console.Commands } } - internal sealed class ListMapsCommand : IConsoleCommand + internal sealed class ListMapsCommand : LocalizedCommands { - public string Command => "lsmap"; - public string Description => "Lists maps"; - public string Help => "lsmap"; + public override string Command => "lsmap"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mapManager = IoCManager.Resolve(); @@ -533,13 +508,10 @@ namespace Robust.Server.Console.Commands } } - internal sealed class ListGridsCommand : IConsoleCommand + internal sealed class ListGridsCommand : LocalizedCommands { - public string Command => "lsgrid"; - public string Description => "List grids"; - public string Help => "lsgrid"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "lsgrid"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var entManager = IoCManager.Resolve(); var mapManager = IoCManager.Resolve(); diff --git a/Robust.Server/Console/Commands/PlayerCommands.cs b/Robust.Server/Console/Commands/PlayerCommands.cs index 5e6da832b3..ffb64da595 100644 --- a/Robust.Server/Console/Commands/PlayerCommands.cs +++ b/Robust.Server/Console/Commands/PlayerCommands.cs @@ -13,13 +13,11 @@ using Robust.Shared.Network; namespace Robust.Server.Console.Commands { - internal sealed class TeleportCommand : IConsoleCommand + internal sealed class TeleportCommand : LocalizedCommands { - public string Command => "tp"; - public string Description => "Teleports a player to any location in the round."; - public string Help => "tp []"; + public override string Command => "tp"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var player = shell.Player as IPlayerSession; if (player?.Status != SessionStatus.InGame) @@ -70,13 +68,11 @@ namespace Robust.Server.Console.Commands } } - public sealed class TeleportToCommand : IConsoleCommand + public sealed class TeleportToCommand : LocalizedCommands { - public string Command => "tpto"; - public string Description => "Teleports the current player or the specified players/entities to the location of last player/entity specified."; - public string Help => "tpto [username|uid]..."; + public override string Command => "tpto"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length == 0) return; @@ -145,13 +141,10 @@ namespace Robust.Server.Console.Commands } } - public sealed class ListPlayers : IConsoleCommand + public sealed class ListPlayers : LocalizedCommands { - public string Command => "listplayers"; - public string Description => "Lists all players currently connected"; - public string Help => "listplayers"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "listplayers"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { // Player: number of people connected and their byond keys // Admin: read a byond variable which shows their ip, byond version, ckey, attached entity and hardware id @@ -177,13 +170,11 @@ namespace Robust.Server.Console.Commands } } - internal sealed class KickCommand : IConsoleCommand + internal sealed class KickCommand : LocalizedCommands { - public string Command => "kick"; - public string Description => "Kicks a connected player out of the server, disconnecting them."; - public string Help => "kick []"; + public override string Command => "kick"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var players = IoCManager.Resolve(); if (args.Length < 1) @@ -215,7 +206,7 @@ namespace Robust.Server.Console.Commands } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { diff --git a/Robust.Server/Console/Commands/ReloadLocalizationsCommand.cs b/Robust.Server/Console/Commands/ReloadLocalizationsCommand.cs index 9db6ddc6f1..0154fadd44 100644 --- a/Robust.Server/Console/Commands/ReloadLocalizationsCommand.cs +++ b/Robust.Server/Console/Commands/ReloadLocalizationsCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Server.Console.Commands { - internal sealed class ReloadLocalizationsCommand : IConsoleCommand + internal sealed class ReloadLocalizationsCommand : LocalizedCommands { - public string Command => "rldloc"; - public string Description => "Reloads localization (client & server)"; - public string Help => "Usage: rldloc"; + public override string Command => "rldloc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().ReloadLocalizations(); } diff --git a/Robust.Server/Console/Commands/RemoveComponentCommand.cs b/Robust.Server/Console/Commands/RemoveComponentCommand.cs index 466fe89dc4..5b8458bc04 100644 --- a/Robust.Server/Console/Commands/RemoveComponentCommand.cs +++ b/Robust.Server/Console/Commands/RemoveComponentCommand.cs @@ -7,13 +7,11 @@ using Robust.Shared.IoC; namespace Robust.Server.Console.Commands { [UsedImplicitly] - internal sealed class RemoveComponentCommand : IConsoleCommand + internal sealed class RemoveComponentCommand : LocalizedCommands { - public string Command => "rmcomp"; - public string Description => "Removes a component from an entity."; - public string Help => $"{Command} "; + public override string Command => "rmcomp"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { diff --git a/Robust.Server/Console/Commands/ScaleCommand.cs b/Robust.Server/Console/Commands/ScaleCommand.cs index 19088d4f1e..c7504da8c3 100644 --- a/Robust.Server/Console/Commands/ScaleCommand.cs +++ b/Robust.Server/Console/Commands/ScaleCommand.cs @@ -10,12 +10,10 @@ using Robust.Shared.Physics.Systems; namespace Robust.Server.Console.Commands; -public sealed class ScaleCommand : IConsoleCommand +public sealed class ScaleCommand : LocalizedCommands { - public string Command => "scale"; - public string Description => "Increases or decreases an entity's size naively"; - public string Help => $"{Command} "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "scale"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { diff --git a/Robust.Server/Console/Commands/SpawnCommand.cs b/Robust.Server/Console/Commands/SpawnCommand.cs index f15b0aa661..e599733b43 100644 --- a/Robust.Server/Console/Commands/SpawnCommand.cs +++ b/Robust.Server/Console/Commands/SpawnCommand.cs @@ -8,13 +8,11 @@ using Robust.Shared.Map; namespace Robust.Server.Console.Commands { - public sealed class SpawnCommand : IConsoleCommand + public sealed class SpawnCommand : LocalizedCommands { - public string Command => "spawn"; - public string Description => "Spawns an entity with specific type."; - public string Help => "spawn OR spawn OR spawn "; + public override string Command => "spawn"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var player = shell.Player as IPlayerSession; var ent = IoCManager.Resolve(); diff --git a/Robust.Server/Console/Commands/SpinCommand.cs b/Robust.Server/Console/Commands/SpinCommand.cs index 311fc60c8f..90938cda20 100644 --- a/Robust.Server/Console/Commands/SpinCommand.cs +++ b/Robust.Server/Console/Commands/SpinCommand.cs @@ -6,13 +6,11 @@ using Robust.Shared.Physics.Components; namespace Robust.Server.Console.Commands; -public sealed class SpinCommand : IConsoleCommand +public sealed class SpinCommand : LocalizedCommands { - public string Command => "spin"; - public string Description => "Causes an entity to spin. Default entity is the attached player's parent."; - public string Help => $"{Command} velocity [drag] [entityUid]"; + public override string Command => "spin"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 1) { diff --git a/Robust.Server/Console/Commands/SysCommands.cs b/Robust.Server/Console/Commands/SysCommands.cs index b2b78e8639..dfc5f97e54 100644 --- a/Robust.Server/Console/Commands/SysCommands.cs +++ b/Robust.Server/Console/Commands/SysCommands.cs @@ -3,54 +3,44 @@ using Robust.Shared.Configuration; using Robust.Shared.Console; using Robust.Shared.IoC; using Robust.Shared.Network; -using Robust.Shared.Serialization; using Robust.Shared.Timing; namespace Robust.Server.Console.Commands { - sealed class RestartCommand : IConsoleCommand + sealed class RestartCommand : LocalizedCommands { - public string Command => "restart"; - public string Description => "Gracefully restarts the server (not just the round)."; - public string Help => "restart"; + public override string Command => "restart"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().Restart(); } } - sealed class ShutdownCommand : IConsoleCommand + sealed class ShutdownCommand : LocalizedCommands { - public string Command => "shutdown"; - public string Description => "Gracefully shuts down the server."; - public string Help => "shutdown"; + public override string Command => "shutdown"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().Shutdown(null); } } - public sealed class SaveConfig : IConsoleCommand + public sealed class SaveConfig : LocalizedCommands { - public string Command => "saveconfig"; - public string Description => "Saves the server configuration to the config file"; - public string Help => "saveconfig"; + public override string Command => "saveconfig"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { IoCManager.Resolve().SaveToFile(); } } - sealed class NetworkAuditCommand : IConsoleCommand + sealed class NetworkAuditCommand : LocalizedCommands { - public string Command => "netaudit"; - public string Description => "Prints into about NetMsg security."; - public string Help => "netaudit"; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "netaudit"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var network = (NetManager) IoCManager.Resolve(); @@ -70,13 +60,11 @@ namespace Robust.Server.Console.Commands } } - sealed class ShowTimeCommand : IConsoleCommand + sealed class ShowTimeCommand : LocalizedCommands { - public string Command => "showtime"; - public string Description => "Shows the server time."; - public string Help => "showtime"; + public override string Command => "showtime"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var timing = IoCManager.Resolve(); shell.WriteLine($"Paused: {timing.Paused}, CurTick: {timing.CurTick}, CurTime: {timing.CurTime}, RealTime: {timing.RealTime}"); diff --git a/Robust.Server/Console/Commands/TestbedCommand.cs b/Robust.Server/Console/Commands/TestbedCommand.cs index dd4f3b931e..79f8cc81c2 100644 --- a/Robust.Server/Console/Commands/TestbedCommand.cs +++ b/Robust.Server/Console/Commands/TestbedCommand.cs @@ -46,12 +46,11 @@ namespace Robust.Server.Console.Commands /// /// Copies of Box2D's physics testbed for debugging. /// - public sealed class TestbedCommand : IConsoleCommand + public sealed class TestbedCommand : LocalizedCommands { - public string Command => "testbed"; - public string Description => "Loads a physics testbed on the specified map."; - public string Help => $"{Command} "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "testbed"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { diff --git a/Robust.Server/Console/Commands/ViewSubscriberCommand.cs b/Robust.Server/Console/Commands/ViewSubscriberCommand.cs index dfb4a6bafc..514fea3268 100644 --- a/Robust.Server/Console/Commands/ViewSubscriberCommand.cs +++ b/Robust.Server/Console/Commands/ViewSubscriberCommand.cs @@ -7,12 +7,11 @@ using Robust.Shared.Players; namespace Robust.Server.Console.Commands { - public sealed class AddViewSubscriberCommand : IConsoleCommand + public sealed class AddViewSubscriberCommand : LocalizedCommands { - public string Command => "addview"; - public string Description => $"Allows you to subscribe to an entity's view for debugging purposes"; - public string Help => $"{Command} "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "addview"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var session = shell.Player; @@ -45,13 +44,11 @@ namespace Robust.Server.Console.Commands EntitySystem.Get().AddViewSubscriber(uid, playerSession); } - public sealed class RemoveViewSubscriberCommand : IConsoleCommand + public sealed class RemoveViewSubscriberCommand : LocalizedCommands { - public string Command => "removeview"; - public string Description => $"Allows you to unsubscribe to an entity's view for debugging purposes"; - public string Help => $"{Command} "; + public override string Command => "removeview"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var session = shell.Player; diff --git a/Robust.Shared/Configuration/ConfigurationCommands.cs b/Robust.Shared/Configuration/ConfigurationCommands.cs index 151f23b66b..5a3c3ecf98 100644 --- a/Robust.Shared/Configuration/ConfigurationCommands.cs +++ b/Robust.Shared/Configuration/ConfigurationCommands.cs @@ -9,14 +9,11 @@ using Robust.Shared.Utility; namespace Robust.Shared.Configuration { [SuppressMessage("ReSharper", "StringLiteralTypo")] - internal sealed class CVarCommand : IConsoleCommand + internal sealed class CVarCommand : LocalizedCommands { - public string Command => "cvar"; - public string Description => Loc.GetString("cmd-cvar-desc"); + public override string Command => "cvar"; - public string Help => Loc.GetString("cmd-cvar-help"); - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length is < 1 or > 2) { @@ -63,7 +60,7 @@ namespace Robust.Shared.Configuration } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { var cfg = IoCManager.Resolve(); if (args.Length == 1) diff --git a/Robust.Shared/Console/Commands/DumpEventTablesCommand.cs b/Robust.Shared/Console/Commands/DumpEventTablesCommand.cs index 1e5092e198..3e7c132b35 100644 --- a/Robust.Shared/Console/Commands/DumpEventTablesCommand.cs +++ b/Robust.Shared/Console/Commands/DumpEventTablesCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Shared.Console.Commands; -internal sealed class DumpEventTablesCommand : IConsoleCommand +internal sealed class DumpEventTablesCommand : LocalizedCommands { - public string Command => "dump_event_tables"; - public string Description => Loc.GetString("cmd-dump_event_tables-desc"); - public string Help => Loc.GetString("cmd-dump_event_tables-help"); + public override string Command => "dump_event_tables"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var entMgr = IoCManager.Resolve(); var compFactory = IoCManager.Resolve(); @@ -46,7 +44,7 @@ internal sealed class DumpEventTablesCommand : IConsoleCommand } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) return CompletionResult.FromHint(Loc.GetString("cmd-dump_event_tables-arg-entity")); diff --git a/Robust.Shared/Console/Commands/DumpNetComponentsCommand.cs b/Robust.Shared/Console/Commands/DumpNetComponentsCommand.cs index 205e5e53f4..c40d2ace81 100644 --- a/Robust.Shared/Console/Commands/DumpNetComponentsCommand.cs +++ b/Robust.Shared/Console/Commands/DumpNetComponentsCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Shared.Console.Commands; -internal sealed class DumpNetComponentsCommand : IConsoleCommand +internal sealed class DumpNetComponentsCommand : LocalizedCommands { - public string Command => "dump_net_comps"; - public string Description => Loc.GetString("cmd-dump_net_comps-desc"); - public string Help => Loc.GetString("cmd-dump_net_comps-help"); + public override string Command => "dump_net_comps"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var mgr = IoCManager.Resolve(); diff --git a/Robust.Shared/Console/Commands/ExecCommand.cs b/Robust.Shared/Console/Commands/ExecCommand.cs index e61e0ce2e8..1ae66c0d98 100644 --- a/Robust.Shared/Console/Commands/ExecCommand.cs +++ b/Robust.Shared/Console/Commands/ExecCommand.cs @@ -8,15 +8,13 @@ using Robust.Shared.Utility; namespace Robust.Shared.Console.Commands { [UsedImplicitly] - internal sealed class ExecCommand : IConsoleCommand + internal sealed class ExecCommand : LocalizedCommands { private static readonly Regex CommentRegex = new Regex(@"^\s*#"); - public string Command => "exec"; - public string Description => Loc.GetString("cmd-exec-desc"); - public string Help => Loc.GetString("cmd-exec-help"); + public override string Command => "exec"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var res = IoCManager.Resolve(); @@ -52,7 +50,7 @@ namespace Robust.Shared.Console.Commands } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { diff --git a/Robust.Shared/Console/Commands/GcCommands.cs b/Robust.Shared/Console/Commands/GcCommands.cs index aa02d44158..d15180d035 100644 --- a/Robust.Shared/Console/Commands/GcCommands.cs +++ b/Robust.Shared/Console/Commands/GcCommands.cs @@ -5,13 +5,11 @@ using Robust.Shared.Utility; namespace Robust.Shared.Console.Commands; -internal sealed class GcCommand : IConsoleCommand +internal sealed class GcCommand : LocalizedCommands { - public string Command => "gc"; - public string Description => Loc.GetString("cmd-gc-desc"); - public string Help => Loc.GetString("cmd-gc-help"); + public override string Command => "gc"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length == 0) { @@ -26,7 +24,7 @@ internal sealed class GcCommand : IConsoleCommand } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) return CompletionResult.FromHint(Loc.GetString("cmd-gc-arg-generation")); @@ -35,28 +33,22 @@ internal sealed class GcCommand : IConsoleCommand } } -internal sealed class GcFullCommand : IConsoleCommand +internal sealed class GcFullCommand : LocalizedCommands { - public string Command => "gcf"; - public string Description => Loc.GetString("cmd-gcf-desc"); - public string Help => Loc.GetString("cmd-gcf-help"); + public override string Command => "gcf"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(2, GCCollectionMode.Forced, true, true); } } -internal sealed class GcModeCommand : IConsoleCommand +internal sealed class GcModeCommand : LocalizedCommands { - public string Command => "gc_mode"; + public override string Command => "gc_mode"; - public string Description => Loc.GetString("cmd-gc_mode-desc"); - - public string Help => Loc.GetString("cmd-gc_mode-help"); - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var prevMode = GCSettings.LatencyMode; if (args.Length == 0) @@ -84,7 +76,7 @@ internal sealed class GcModeCommand : IConsoleCommand } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { @@ -97,13 +89,11 @@ internal sealed class GcModeCommand : IConsoleCommand } } -internal sealed class MemCommand : IConsoleCommand +internal sealed class MemCommand : LocalizedCommands { - public string Command => "mem"; - public string Description => Loc.GetString("cmd-mem-desc"); - public string Help => Loc.GetString("cmd-mem-help"); + public override string Command => "mem"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var info = GC.GetGCMemoryInfo(); diff --git a/Robust.Shared/Console/Commands/HelpCommand.cs b/Robust.Shared/Console/Commands/HelpCommand.cs index 654e3a0235..ef897e50d2 100644 --- a/Robust.Shared/Console/Commands/HelpCommand.cs +++ b/Robust.Shared/Console/Commands/HelpCommand.cs @@ -3,13 +3,11 @@ using Robust.Shared.Localization; namespace Robust.Shared.Console.Commands; -internal sealed class HelpCommand : IConsoleCommand +internal sealed class HelpCommand : LocalizedCommands { - public string Command => "help"; - public string Description => Loc.GetString("cmd-help-desc"); - public string Help => Loc.GetString("cmd-help-help"); + public override string Command => "help"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { switch (args.Length) { @@ -36,7 +34,7 @@ internal sealed class HelpCommand : IConsoleCommand } } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) { diff --git a/Robust.Shared/Console/Commands/ListAssembliesCommand.cs b/Robust.Shared/Console/Commands/ListAssembliesCommand.cs index 8b9ed57dd1..467c4bc649 100644 --- a/Robust.Shared/Console/Commands/ListAssembliesCommand.cs +++ b/Robust.Shared/Console/Commands/ListAssembliesCommand.cs @@ -4,13 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Shared.Console.Commands; -internal sealed class ListAssembliesCommand : IConsoleCommand +internal sealed class ListAssembliesCommand : LocalizedCommands { - public string Command => "lsasm"; - public string Description => Loc.GetString("cmd-lsasm-desc"); - public string Help => Loc.GetString("cmd-lsasm-help"); + public override string Command => "lsasm"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var sb = new StringBuilder(); foreach (var context in AssemblyLoadContext.All) diff --git a/Robust.Shared/Console/Commands/ListCommand.cs b/Robust.Shared/Console/Commands/ListCommand.cs index 1c80b60338..39aa41a7ba 100644 --- a/Robust.Shared/Console/Commands/ListCommand.cs +++ b/Robust.Shared/Console/Commands/ListCommand.cs @@ -4,15 +4,11 @@ using Robust.Shared.Localization; namespace Robust.Shared.Console.Commands; -internal sealed class ListCommands : IConsoleCommand +internal sealed class ListCommands : LocalizedCommands { - public string Command => "list"; + public override string Command => "list"; - public string Description => Loc.GetString("cmd-list-desc"); - - public string Help => Loc.GetString("cmd-list-help"); - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { var filter = ""; if (args.Length == 1) @@ -35,7 +31,7 @@ internal sealed class ListCommands : IConsoleCommand shell.WriteLine(message); } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { if (args.Length == 1) return CompletionResult.FromHint(Loc.GetString("cmd-list-arg-filter")); diff --git a/Robust.Shared/Console/Commands/LogCommands.cs b/Robust.Shared/Console/Commands/LogCommands.cs index 54beab116a..63da8d8363 100644 --- a/Robust.Shared/Console/Commands/LogCommands.cs +++ b/Robust.Shared/Console/Commands/LogCommands.cs @@ -5,16 +5,10 @@ using Robust.Shared.Log; namespace Robust.Shared.Console.Commands; -internal sealed class LogSetLevelCommand : IConsoleCommand +internal sealed class LogSetLevelCommand : LocalizedCommands { - public string Command => "loglevel"; - public string Description => "Changes the log level for a provided sawmill."; - - public string Help => "Usage: loglevel " - + "\n sawmill: A label prefixing log messages. This is the one you're setting the level for." - + "\n level: The log level. Must match one of the values of the LogLevel enum."; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override string Command => "loglevel"; + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 2) { @@ -43,7 +37,7 @@ internal sealed class LogSetLevelCommand : IConsoleCommand Logger.GetSawmill(name).Level = level; } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { var logMgr = IoCManager.Resolve(); @@ -64,17 +58,11 @@ internal sealed class LogSetLevelCommand : IConsoleCommand } } -internal sealed class TestLog : IConsoleCommand +internal sealed class TestLog : LocalizedCommands { - public string Command => "testlog"; - public string Description => "Writes a test log to a sawmill."; + public override string Command => "testlog"; - public string Help => "Usage: testlog " - + "\n sawmill: A label prefixing the logged message." - + "\n level: The log level. Must match one of the values of the LogLevel enum." - + "\n message: The message to be logged. Wrap this in double quotes if you want to use spaces."; - - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 3) { @@ -96,7 +84,7 @@ internal sealed class TestLog : IConsoleCommand Logger.LogS(level, name, message); } - public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + public override CompletionResult GetCompletion(IConsoleShell shell, string[] args) { var logMgr = IoCManager.Resolve(); diff --git a/Robust.Shared/Console/Commands/SerializerStatsCommand.cs b/Robust.Shared/Console/Commands/SerializerStatsCommand.cs index ca7bc0f1f0..25853ee2b2 100644 --- a/Robust.Shared/Console/Commands/SerializerStatsCommand.cs +++ b/Robust.Shared/Console/Commands/SerializerStatsCommand.cs @@ -2,13 +2,11 @@ namespace Robust.Shared.Console.Commands; -internal sealed class SerializeStatsCommand : IConsoleCommand +internal sealed class SerializeStatsCommand : LocalizedCommands { - public string Command => "szr_stats"; - public string Description => "Report serializer statistics."; - public string Help => "szr_stats"; + public override string Command => "szr_stats"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { shell.WriteLine($"serialized: {RobustSerializer.BytesSerialized} bytes, {RobustSerializer.ObjectsSerialized} objects"); shell.WriteLine($"largest serialized: {RobustSerializer.LargestObjectSerializedBytes} bytes, {RobustSerializer.LargestObjectSerializedType} objects"); diff --git a/Robust.Shared/Console/LocalizedCommands.cs b/Robust.Shared/Console/LocalizedCommands.cs new file mode 100644 index 0000000000..a7ee6670a2 --- /dev/null +++ b/Robust.Shared/Console/LocalizedCommands.cs @@ -0,0 +1,33 @@ +using System.Threading; +using System.Threading.Tasks; +using Robust.Shared.IoC; +using Robust.Shared.Localization; + +namespace Robust.Shared.Console; + +public abstract class LocalizedCommands : IConsoleCommand +{ + [Dependency] protected readonly ILocalizationManager LocalizationManager = default!; + + /// + public abstract string Command { get; } + + /// + public virtual string Description => LocalizationManager.TryGetString($"cmd-{Command}-desc", out var val) ? val : ""; + + /// + public virtual string Help => LocalizationManager.TryGetString($"cmd-{Command}-help", out var val) ? val : ""; + + /// + public abstract void Execute(IConsoleShell shell, string argStr, string[] args); + + /// + public virtual CompletionResult GetCompletion(IConsoleShell shell, string[] args) => CompletionResult.Empty; + + /// + public virtual ValueTask GetCompletionAsync(IConsoleShell shell, string[] args, + CancellationToken cancel) + { + return ValueTask.FromResult(GetCompletion(shell, args)); + } +} diff --git a/Robust.Shared/Network/HWId.cs b/Robust.Shared/Network/HWId.cs index a7731edd30..ad936c0310 100644 --- a/Robust.Shared/Network/HWId.cs +++ b/Robust.Shared/Network/HWId.cs @@ -33,13 +33,11 @@ namespace Robust.Shared.Network } #if DEBUG - internal sealed class HwidCommand : IConsoleCommand + internal sealed class HwidCommand : LocalizedCommands { - public string Command => "hwid"; - public string Description => "Returns the current HWID."; - public string Help => "Returns the current HWID."; + public override string Command => "hwid"; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public override void Execute(IConsoleShell shell, string argStr, string[] args) { shell.WriteLine(Convert.ToBase64String(HWId.Calc(), Base64FormattingOptions.None)); } diff --git a/Robust.Shared/ViewVariables/Commands/ViewVariablesBaseCommand.cs b/Robust.Shared/ViewVariables/Commands/ViewVariablesBaseCommand.cs index 0b50165b3e..5edbcb4eb7 100644 --- a/Robust.Shared/ViewVariables/Commands/ViewVariablesBaseCommand.cs +++ b/Robust.Shared/ViewVariables/Commands/ViewVariablesBaseCommand.cs @@ -7,17 +7,12 @@ using Robust.Shared.Network; namespace Robust.Shared.ViewVariables.Commands; -public abstract class ViewVariablesBaseCommand : IConsoleCommand +public abstract class ViewVariablesBaseCommand : LocalizedCommands { [Dependency] protected readonly INetManager _netMan = default!; [Dependency] protected readonly IViewVariablesManager _vvm = default!; - public abstract string Command { get; } - public abstract string Description { get; } - public abstract string Help { get; } - public abstract void Execute(IConsoleShell shell, string argStr, string[] args); - - public virtual async ValueTask GetCompletionAsync(IConsoleShell shell, string[] args, CancellationToken cancel) + public override async ValueTask GetCompletionAsync(IConsoleShell shell, string[] args, CancellationToken cancel) { if (args.Length is 0 or > 1) return CompletionResult.Empty; diff --git a/Robust.Shared/ViewVariables/Commands/ViewVariablesInvokeCommand.cs b/Robust.Shared/ViewVariables/Commands/ViewVariablesInvokeCommand.cs index 46b2549004..788bde6510 100644 --- a/Robust.Shared/ViewVariables/Commands/ViewVariablesInvokeCommand.cs +++ b/Robust.Shared/ViewVariables/Commands/ViewVariablesInvokeCommand.cs @@ -3,11 +3,9 @@ using Robust.Shared.IoC; namespace Robust.Shared.ViewVariables.Commands; -public sealed class ViewVariablesInvokeCommand : ViewVariablesBaseCommand, IConsoleCommand +public sealed class ViewVariablesInvokeCommand : ViewVariablesBaseCommand { public override string Command => "vvinvoke"; - public override string Description => "Invoke/Call a path with arguments using VV."; - public override string Help => $"{Command} [arguments...]"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { diff --git a/Robust.Shared/ViewVariables/Commands/ViewVariablesReadCommand.cs b/Robust.Shared/ViewVariables/Commands/ViewVariablesReadCommand.cs index 833fb049b1..4f25f5a3ec 100644 --- a/Robust.Shared/ViewVariables/Commands/ViewVariablesReadCommand.cs +++ b/Robust.Shared/ViewVariables/Commands/ViewVariablesReadCommand.cs @@ -2,11 +2,9 @@ using Robust.Shared.Console; namespace Robust.Shared.ViewVariables.Commands; -public sealed class ViewVariablesReadCommand : ViewVariablesBaseCommand, IConsoleCommand +public sealed class ViewVariablesReadCommand : ViewVariablesBaseCommand { public override string Command => "vvread"; - public override string Description => "Retrieve a path's value using VV."; - public override string Help => $"{Command} "; public override async void Execute(IConsoleShell shell, string argStr, string[] args) { diff --git a/Robust.Shared/ViewVariables/Commands/ViewVariablesWriteCommand.cs b/Robust.Shared/ViewVariables/Commands/ViewVariablesWriteCommand.cs index 52e2407e38..b2ca603fe9 100644 --- a/Robust.Shared/ViewVariables/Commands/ViewVariablesWriteCommand.cs +++ b/Robust.Shared/ViewVariables/Commands/ViewVariablesWriteCommand.cs @@ -2,11 +2,9 @@ using Robust.Shared.Console; namespace Robust.Shared.ViewVariables.Commands; -public sealed class ViewVariablesWriteCommand : ViewVariablesBaseCommand, IConsoleCommand +public sealed class ViewVariablesWriteCommand : ViewVariablesBaseCommand { public override string Command => "vvwrite"; - public override string Description => "Modify a path's value using VV."; - public override string Help => $"{Command} "; public override void Execute(IConsoleShell shell, string argStr, string[] args) {