Files
tbd-station-14/Content.Client/Commands/DebugAiCommand.cs
Acruid 8b5d66050a Console Unify API Changes (#3059)
* Remove unused IChatCommand.

* Lots of refactoring into a shared context.

* Removed ICommonSession from server concmd Execute.

* Added argStr parameter to concmd execute.

* The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands.

* Finally move shells and commands into shared.

* Console commands can now be registered directly without a class in a shared context.

* Engine API Changes.

* Repair rebase damage.

* Update Submodule.
2021-02-01 16:49:43 -08:00

62 lines
1.9 KiB
C#

using Content.Client.GameObjects.EntitySystems.AI;
using JetBrains.Annotations;
using Robust.Shared.Console;
using Robust.Shared.GameObjects.Systems;
namespace Content.Client.Commands
{
/// <summary>
/// This is used to handle the tooltips above AI mobs
/// </summary>
[UsedImplicitly]
internal sealed class DebugAiCommand : IConsoleCommand
{
// ReSharper disable once StringLiteralTypo
public string Command => "debugai";
public string Description => "Handles all tooltip debugging above AI mobs";
public string Help => "debugai [hide/paths/thonk]";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
#if DEBUG
if (args.Length < 1)
{
shell.RemoteExecuteCommand(argStr);
return;
}
var anyAction = false;
var debugSystem = EntitySystem.Get<ClientAiDebugSystem>();
foreach (var arg in args)
{
switch (arg)
{
case "hide":
debugSystem.Disable();
anyAction = true;
break;
// This will show the pathfinding numbers above the mob's head
case "paths":
debugSystem.ToggleTooltip(AiDebugMode.Paths);
anyAction = true;
break;
// Shows stats on what the AI was thinking.
case "thonk":
debugSystem.ToggleTooltip(AiDebugMode.Thonk);
anyAction = true;
break;
default:
continue;
}
}
if(!anyAction)
shell.RemoteExecuteCommand(argStr);
#else
shell.RemoteExecuteCommand(argStr);
#endif
}
}
}