From 4e445ee3136539712d7adde65aefd67da1446257 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 20 May 2022 14:17:20 +1000 Subject: [PATCH] Physics command niceties (#2843) --- Resources/Locale/en-US/commands.ftl | 3 +++ .../Commands/PhysicsOverlayCommands.cs | 22 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Resources/Locale/en-US/commands.ftl b/Resources/Locale/en-US/commands.ftl index c0e386926..c3a27cd1b 100644 --- a/Resources/Locale/en-US/commands.ftl +++ b/Resources/Locale/en-US/commands.ftl @@ -74,6 +74,9 @@ cmd-mem-help = Usage: mem cmd-mem-report = Heap Size: { TOSTRING($heapSize, "N0") } Total Allocated: { TOSTRING($totalAllocated, "N0") } +## 'physics' command +cmd-physics-overlay = {$overlay} is not a recognised overlay + ## 'lsasm' command cmd-lsasm-desc = Lists loaded assemblies by load context cmd-lsasm-help = Usage: lsasm diff --git a/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs b/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs index b0d678d1d..6b50c6b01 100644 --- a/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs +++ b/Robust.Client/Console/Commands/PhysicsOverlayCommands.cs @@ -1,6 +1,7 @@ using Robust.Client.Debugging; using Robust.Shared.Console; using Robust.Shared.GameObjects; +using Robust.Shared.Localization; namespace Robust.Client.Console.Commands { @@ -9,11 +10,12 @@ namespace Robust.Client.Console.Commands public string Command => "physics"; public string Description => $"Shows a debug physics overlay. The arg supplied specifies the overlay."; public string Help => $"{Command} "; + public void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { - shell.WriteError($"Invalid number of args supplied"); + shell.WriteError(Loc.GetString("shell-wrong-arguments-number-need-specific", ("properAmount", 1), ("currentAmount", args.Length))); return; } @@ -43,11 +45,27 @@ namespace Robust.Client.Console.Commands system.Flags ^= PhysicsDebugFlags.Shapes; break; default: - shell.WriteError($"{args[0]} is not a recognised overlay"); + shell.WriteError(Loc.GetString("cmd-physics-overlay", ("overlay", args[0]))); return; } return; } + + public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + { + if (args.Length != 1) return CompletionResult.Empty; + + return CompletionResult.FromOptions(new[] + { + "aabbs", + "com", + "contactnormals", + "contactpoints", + "joints", + "shapeinfo", + "shapes", + }); + } } }