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.
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
// This file is for commands that do something to the console itself.
|
|
// Not some generic console command type.
|
|
// Couldn't think of a better name sorry.
|
|
|
|
using System;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.Interfaces.Random;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.Console.Commands
|
|
{
|
|
class ClearCommand : IConsoleCommand
|
|
{
|
|
public string Command => "cls";
|
|
public string Help => "Clears the debug console of all messages.";
|
|
public string Description => "Clears the console.";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
shell.Clear();
|
|
}
|
|
}
|
|
|
|
class FillCommand : IConsoleCommand
|
|
{
|
|
public string Command => "fill";
|
|
public string Help => "Fills the console with some nonsense for debugging.";
|
|
public string Description => "Fill up the console for debugging.";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
Color[] colors = { Color.Green, Color.Blue, Color.Red };
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
for (int x = 0; x < 50; x++)
|
|
{
|
|
shell.WriteLine("filling...", colors[random.Next(0, colors.Length)]);
|
|
}
|
|
}
|
|
}
|
|
}
|