2021-10-28 18:21:19 +13:00
|
|
|
using Content.Client.ContextMenu.UI;
|
2021-06-13 14:52:40 +02:00
|
|
|
using Content.Shared.CCVar;
|
2021-02-25 19:42:16 -06:00
|
|
|
using Robust.Shared.Configuration;
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Commands
|
|
|
|
|
{
|
2021-10-28 18:21:19 +13:00
|
|
|
public class GroupingEntityMenuCommand : IConsoleCommand
|
2021-02-25 19:42:16 -06:00
|
|
|
{
|
2021-10-28 18:21:19 +13:00
|
|
|
public string Command => "entitymenug";
|
2021-02-25 19:42:16 -06:00
|
|
|
|
2021-10-28 18:21:19 +13:00
|
|
|
public string Description => "Sets the entity menu grouping type.";
|
2021-02-25 19:42:16 -06:00
|
|
|
|
2021-10-28 18:21:19 +13:00
|
|
|
public string Help => $"Usage: entitymenug <0:{EntityMenuPresenter.GroupingTypesCount}>";
|
2021-02-25 19:42:16 -06:00
|
|
|
public 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.WriteLine($"{args[0]} is not a valid integer.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-28 18:21:19 +13:00
|
|
|
if (id < 0 ||id > EntityMenuPresenter.GroupingTypesCount - 1)
|
2021-02-25 19:42:16 -06:00
|
|
|
{
|
|
|
|
|
shell.WriteLine($"{args[0]} is not a valid integer.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
|
2021-10-28 18:21:19 +13:00
|
|
|
var cvar = CCVars.EntityMenuGroupingType;
|
2021-02-25 19:42:16 -06:00
|
|
|
|
|
|
|
|
configurationManager.SetCVar(cvar, id);
|
|
|
|
|
shell.WriteLine($"Context Menu Grouping set to type: {configurationManager.GetCVar(cvar)}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|