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.
59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using Robust.Shared.Maths;
|
|
using Robust.Shared.Players;
|
|
|
|
namespace Robust.Shared.Console
|
|
{
|
|
/// <inheritdoc />
|
|
public class ConsoleShell : IConsoleShell
|
|
{
|
|
/// <inheritdoc />
|
|
public IConsoleHost ConsoleHost { get; }
|
|
|
|
/// <inheritdoc />
|
|
public bool IsServer => ConsoleHost.IsServer;
|
|
|
|
/// <inheritdoc />
|
|
public ICommonSession? Player { get; }
|
|
|
|
public ConsoleShell(IConsoleHost host, ICommonSession? session)
|
|
{
|
|
ConsoleHost = host;
|
|
Player = session;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void ExecuteCommand(string command)
|
|
{
|
|
ConsoleHost.ExecuteCommand(Player, command);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void RemoteExecuteCommand(string command)
|
|
{
|
|
ConsoleHost.RemoteExecuteCommand(Player, command);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void WriteLine(string text)
|
|
{
|
|
ConsoleHost.WriteLine(Player, text);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void WriteLine(string text, Color color)
|
|
{
|
|
ConsoleHost.WriteLine(Player, text, color);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void Clear()
|
|
{
|
|
// Only the local shell can clear the console
|
|
if (Player is not null)
|
|
return;
|
|
|
|
ConsoleHost.ClearLocalConsole();
|
|
}
|
|
}
|
|
}
|