mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
41 lines
1.4 KiB
C#
41 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 partial class GroupingEntityMenuCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private 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))));
|
|
}
|
|
}
|