Client commands: clean up and localize (#22897)

* action commands

* atmos debug commands

* comming

* credits command

* debug commands

* usage

* usings

* debug pathfinding command

* grouping entity menu command

* hide mechanisms command

* commit

* mapping client side setup command

* open ahelp command

* set menu visibility command

* commit

* show mechanisms command

* toggle health overlay command

* toggle outline command

* stage

* disable once

* ioc

* namespaces

* WriteError

* clean up command usage

* don't abbriviate

* ActionsCommands

* AtmosDebugCommands

* the rest

* oops

* undo
This commit is contained in:
PrPleGoo
2024-01-03 23:29:37 +01:00
committed by GitHub
parent e790e59e19
commit 0e306e7862
28 changed files with 495 additions and 447 deletions

View File

@@ -1,4 +1,4 @@
using Content.Client.Actions;
using Content.Client.Actions;
using Content.Client.Mapping;
using Content.Shared.Administration;
using Robust.Shared.Console;
@@ -12,11 +12,8 @@ namespace Content.Client.Commands;
public sealed class SaveActionsCommand : IConsoleCommand
{
public string Command => "saveacts";
public string Description => "Saves the current action toolbar assignments to a file";
public string Help => $"Usage: {Command} <user resource path>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
@@ -38,15 +35,15 @@ public sealed class SaveActionsCommand : IConsoleCommand
*/
[AnyCommand]
public sealed class LoadActionsCommand : IConsoleCommand
public sealed class LoadActionsCommand : LocalizedCommands
{
public string Command => "loadacts";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public string Description => "Loads action toolbar assignments from a user-file.";
public override string Command => "loadacts";
public string Help => $"Usage: {Command} <user resource path>";
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
@@ -56,33 +53,35 @@ public sealed class LoadActionsCommand : IConsoleCommand
try
{
EntitySystem.Get<ActionsSystem>().LoadActionAssignments(args[0], true);
_entitySystemManager.GetEntitySystem<ActionsSystem>().LoadActionAssignments(args[0], true);
}
catch
{
shell.WriteLine("Failed to load action assignments");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
}
}
}
[AnyCommand]
public sealed class LoadMappingActionsCommand : IConsoleCommand
public sealed class LoadMappingActionsCommand : LocalizedCommands
{
public string Command => "loadmapacts";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public string Description => "Loads the mapping preset action toolbar assignments.";
public const string CommandName = "loadmapacts";
public string Help => $"Usage: {Command}";
public override string Command => CommandName;
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
try
{
EntitySystem.Get<MappingSystem>().LoadMappingActions();
_entitySystemManager.GetEntitySystem<MappingSystem>().LoadMappingActions();
}
catch
{
shell.WriteLine("Failed to load action assignments");
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
}
}
}