Physics command niceties (#2843)

This commit is contained in:
metalgearsloth
2022-05-20 14:17:20 +10:00
committed by GitHub
parent c6be3e145a
commit 4e445ee313
2 changed files with 23 additions and 2 deletions

View File

@@ -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

View File

@@ -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} <aabbs / com / contactnormals / contactpoints / joints / shapeinfo / shapes>";
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",
});
}
}
}