mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* Saving work * Move shit to engine * lord * merg * awa * bql is kill * forgot the fucking bike rack * bql is kill for real * pjb will kill me * aughfhbdj * yo ho here we go on my way to the MINES * a * adgddf * gdsgvfvxshngfgh * b * hfsjhghj * hbfdjjh * tf you mean i have to document it * follow C# standards * Assorted cleanup and documentation pass, minor bugfix in ValueRefParser. * Start porting old commands, remove that pesky prefix in favor of integrating with the shell. * Fix valueref up a bit, improve autocomplete for it. * e * Toolshed type system adventure. * a log * a * a e i o u * awa * fix tests * Arithmetic commands. * a * parse improvements --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
74 lines
1.7 KiB
C#
74 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Players;
|
|
using Robust.Shared.Toolshed.Errors;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Toolshed.Invocation;
|
|
|
|
/// <inheritdoc />
|
|
internal sealed class OldShellInvocationContext : IInvocationContext
|
|
{
|
|
[Dependency] private readonly ToolshedManager _toolshed = default!;
|
|
private readonly List<IConError> _errors = new();
|
|
|
|
/// <summary>
|
|
/// Old system's shell associated with this context
|
|
/// </summary>
|
|
public IConsoleShell Shell;
|
|
|
|
public OldShellInvocationContext(IConsoleShell shell)
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
Shell = shell;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public bool CheckInvokable(CommandSpec command, out IConError? error)
|
|
{
|
|
if (_toolshed.ActivePermissionController is { } controller)
|
|
return controller.CheckInvokable(command, Session, out error);
|
|
|
|
error = null;
|
|
return true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public ICommonSession? Session => Shell.Player;
|
|
|
|
/// <inheritdoc />
|
|
public void WriteLine(string line)
|
|
{
|
|
Shell.WriteLine(line);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void WriteLine(FormattedMessage line)
|
|
{
|
|
Shell.WriteLine(line);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void ReportError(IConError err)
|
|
{
|
|
_errors.Add(err);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<IConError> GetErrors()
|
|
{
|
|
return _errors;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void ClearErrors()
|
|
{
|
|
_errors.Clear();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public Dictionary<string, object?> Variables { get; } = new();
|
|
}
|
|
|