* 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
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Content.Client.ContextMenu.UI;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Client.Commands;
|
|
|
|
public sealed class GroupingEntityMenuCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
|
|
|
public override string Command => "entitymenug";
|
|
|
|
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command), ("groupingTypesCount", EntityMenuUIController.GroupingTypesCount));
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteLine(Help);
|
|
return;
|
|
}
|
|
|
|
if (!int.TryParse(args[0], out var id))
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
if (id < 0 || id > EntityMenuUIController.GroupingTypesCount - 1)
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
var cvar = CCVars.EntityMenuGroupingType;
|
|
|
|
_configurationManager.SetCVar(cvar, id);
|
|
shell.WriteLine(LocalizationManager.GetString($"cmd-{Command}-notify", ("cvar", _configurationManager.GetCVar(cvar))));
|
|
}
|
|
}
|