mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
35 lines
970 B
C#
35 lines
970 B
C#
using JetBrains.Annotations;
|
|
using Robust.Client.Input;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Robust.Client.Console.Commands
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class SetInputContextCommand : IConsoleCommand
|
|
{
|
|
public string Command => "setinputcontext";
|
|
public string Description => "Sets the active input context.";
|
|
public string Help => "setinputcontext <context>";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteLine("Invalid number of arguments!");
|
|
return;
|
|
}
|
|
|
|
var inputMan = IoCManager.Resolve<IInputManager>();
|
|
|
|
if (!inputMan.Contexts.Exists(args[0]))
|
|
{
|
|
shell.WriteLine("Context not found!");
|
|
return;
|
|
}
|
|
|
|
inputMan.Contexts.SetActiveContext(args[0]);
|
|
}
|
|
}
|
|
}
|