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:
@@ -1,61 +1,61 @@
|
||||
using System.Linq;
|
||||
using Content.Client.NPC;
|
||||
using Content.Shared.NPC;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Console;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
namespace Content.Client.Commands;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class DebugPathfindingCommand : LocalizedCommands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class DebugPathfindingCommand : IConsoleCommand
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
|
||||
public override string Command => "pathfinder";
|
||||
|
||||
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
public string Command => "pathfinder";
|
||||
public string Description => "Toggles visibility of pathfinding debuggers.";
|
||||
public string Help => "pathfinder [options]";
|
||||
var system = _entitySystemManager.GetEntitySystem<PathfindingSystem>();
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
if (args.Length == 0)
|
||||
{
|
||||
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PathfindingSystem>();
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
system.Modes = PathfindingDebugMode.None;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var arg in args)
|
||||
{
|
||||
if (!Enum.TryParse<PathfindingDebugMode>(arg, out var mode))
|
||||
{
|
||||
shell.WriteError($"Unrecognised pathfinder args {arg}");
|
||||
continue;
|
||||
}
|
||||
|
||||
system.Modes ^= mode;
|
||||
shell.WriteLine($"Toggled {arg} to {(system.Modes & mode) != 0x0}");
|
||||
}
|
||||
system.Modes = PathfindingDebugMode.None;
|
||||
return;
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
foreach (var arg in args)
|
||||
{
|
||||
if (args.Length > 1)
|
||||
if (!Enum.TryParse<PathfindingDebugMode>(arg, out var mode))
|
||||
{
|
||||
return CompletionResult.Empty;
|
||||
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg)));
|
||||
continue;
|
||||
}
|
||||
|
||||
var values = Enum.GetValues<PathfindingDebugMode>().ToList();
|
||||
var options = new List<CompletionOption>();
|
||||
|
||||
foreach (var val in values)
|
||||
{
|
||||
if (val == PathfindingDebugMode.None)
|
||||
continue;
|
||||
|
||||
options.Add(new CompletionOption(val.ToString()));
|
||||
}
|
||||
|
||||
return CompletionResult.FromOptions(options);
|
||||
system.Modes ^= mode;
|
||||
shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("arg", arg), ("newMode", (system.Modes & mode) != 0x0)));
|
||||
}
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length > 1)
|
||||
{
|
||||
return CompletionResult.Empty;
|
||||
}
|
||||
|
||||
var values = Enum.GetValues<PathfindingDebugMode>().ToList();
|
||||
var options = new List<CompletionOption>();
|
||||
|
||||
foreach (var val in values)
|
||||
{
|
||||
if (val == PathfindingDebugMode.None)
|
||||
continue;
|
||||
|
||||
options.Add(new CompletionOption(val.ToString()));
|
||||
}
|
||||
|
||||
return CompletionResult.FromOptions(options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user