Client commands: clean up and localize (#22897)
* 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
This commit is contained in:
@@ -2,42 +2,40 @@ using Content.Client.ContextMenu.UI;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
namespace Content.Client.Commands;
|
||||
|
||||
public sealed class GroupingEntityMenuCommand : LocalizedCommands
|
||||
{
|
||||
public sealed class GroupingEntityMenuCommand : IConsoleCommand
|
||||
[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)
|
||||
{
|
||||
public string Command => "entitymenug";
|
||||
|
||||
public string Description => "Sets the entity menu grouping type.";
|
||||
|
||||
public string Help => $"Usage: entitymenug <0:{EntityMenuUIController.GroupingTypesCount}>";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
if (args.Length != 1)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.WriteLine(Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (id < 0 ||id > EntityMenuUIController.GroupingTypesCount - 1)
|
||||
{
|
||||
shell.WriteLine($"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
|
||||
var cvar = CCVars.EntityMenuGroupingType;
|
||||
|
||||
configurationManager.SetCVar(cvar, id);
|
||||
shell.WriteLine($"Context Menu Grouping set to type: {configurationManager.GetCVar(cvar)}");
|
||||
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))));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user