mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Renamed shared ICommand to IConsoleCommand. * Lots of refactoring into a shared context. * Removed ICommonSession from server concmd Execute. * Added argStr parameter to concmd execute. * The execute function of client concmds now returns void, use the new shell.RemoteExecuteCommand function to forward commands. # Conflicts: # Robust.Client/Console/Commands/Debug.cs * Finally move shells and commands into shared. * Console commands can now be registered directly without a class in a shared context. * Pulled up ConsoleHost and Console shell into a shared context. * Pulled up half the functions of ConsoleHost into a shared context. * Repair rebase damage. * Make LoadConsoleCommands function not remove any previously registered commands.
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.Console.Commands
|
|
{
|
|
#if CLIENT_SCRIPTING
|
|
internal sealed class ScriptCommand : IConsoleCommand
|
|
{
|
|
public string Command => "csi";
|
|
public string Description => "Opens a C# interactive console.";
|
|
public string Help => "csi";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
new ScriptConsoleClient().OpenCentered();
|
|
}
|
|
}
|
|
|
|
internal sealed class WatchCommand : IConsoleCommand
|
|
{
|
|
public string Command => "watch";
|
|
public string Description => "Opens a variable watch window.";
|
|
public string Help => "watch";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
new WatchWindow().OpenCentered();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
internal sealed class ServerScriptCommand : IConsoleCommand
|
|
{
|
|
public string Command => "scsi";
|
|
public string Description => "Opens a C# interactive console on the server.";
|
|
public string Help => "scsi";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var mgr = IoCManager.Resolve<IScriptClient>();
|
|
if (!mgr.CanScript)
|
|
{
|
|
shell.WriteLine(Loc.GetString("You do not have server side scripting permission."), Color.Red);
|
|
return;
|
|
}
|
|
|
|
mgr.StartSession();
|
|
}
|
|
}
|
|
}
|