mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using Robust.Shared.Players;
|
|
|
|
namespace Robust.Shared.Console
|
|
{
|
|
/// <inheritdoc />
|
|
public sealed class ConsoleShell : IConsoleShell
|
|
{
|
|
/// <summary>
|
|
/// Constructs a new instance of <see cref="ConsoleShell"/>.
|
|
/// </summary>
|
|
/// <param name="host">Console Host that owns this shell.</param>
|
|
/// <param name="session">Player Session that this shell represents. If this is null, then
|
|
/// the shell is representing the local console.</param>
|
|
public ConsoleShell(IConsoleHost host, ICommonSession? session)
|
|
{
|
|
ConsoleHost = host;
|
|
Player = session;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IConsoleHost ConsoleHost { get; }
|
|
|
|
/// <inheritdoc />
|
|
public bool IsServer => ConsoleHost.IsServer;
|
|
|
|
/// <inheritdoc />
|
|
public ICommonSession? Player { get; }
|
|
|
|
/// <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 WriteError(string text)
|
|
{
|
|
ConsoleHost.WriteError(Player, text);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void Clear()
|
|
{
|
|
// Only the local shell can clear the console
|
|
if (Player is not null)
|
|
return;
|
|
|
|
ConsoleHost.ClearLocalConsole();
|
|
}
|
|
}
|
|
}
|