* 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
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Content.Client.Verbs;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Client.Commands;
|
|
|
|
[UsedImplicitly]
|
|
internal sealed class SetMenuVisibilityCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
|
|
|
public override string Command => "menuvis";
|
|
|
|
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (!TryParseArguments(shell, args, out var visibility))
|
|
return;
|
|
|
|
_entitySystemManager.GetEntitySystem<VerbSystem>().Visibility = visibility;
|
|
}
|
|
|
|
private bool TryParseArguments(IConsoleShell shell, string[] args, out MenuVisibility visibility)
|
|
{
|
|
visibility = MenuVisibility.Default;
|
|
|
|
foreach (var arg in args)
|
|
{
|
|
switch (arg.ToLower())
|
|
{
|
|
// ReSharper disable once StringLiteralTypo
|
|
case "nofov":
|
|
visibility |= MenuVisibility.NoFov;
|
|
break;
|
|
// ReSharper disable once StringLiteralTypo
|
|
case "incontainer":
|
|
visibility |= MenuVisibility.InContainer;
|
|
break;
|
|
case "invisible":
|
|
visibility |= MenuVisibility.Invisible;
|
|
break;
|
|
case "all":
|
|
visibility |= MenuVisibility.All;
|
|
break;
|
|
default:
|
|
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", arg)));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|