Console Unify API Changes (#3059)

* Remove unused IChatCommand.

* 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.

* Finally move shells and commands into shared.

* Console commands can now be registered directly without a class in a shared context.

* Engine API Changes.

* Repair rebase damage.

* Update Submodule.
This commit is contained in:
Acruid
2021-02-01 16:49:43 -08:00
committed by GitHub
parent 80ad2ef5b7
commit 8b5d66050a
119 changed files with 820 additions and 796 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -12,9 +12,9 @@ using Content.Shared;
using Content.Shared.Administration;
using Content.Shared.Network.NetMessages;
using Robust.Server.Console;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.Network;
@@ -37,7 +37,7 @@ namespace Content.Server.Administration
[Dependency] private readonly IServerNetManager _netMgr = default!;
[Dependency] private readonly IConGroupController _conGroup = default!;
[Dependency] private readonly IResourceManager _res = default!;
[Dependency] private readonly IConsoleShell _consoleShell = default!;
[Dependency] private readonly IServerConsoleHost _consoleHost = default!;
[Dependency] private readonly IChatManager _chat = default!;
private readonly Dictionary<IPlayerSession, AdminReg> _admins = new();
@@ -171,7 +171,7 @@ namespace Content.Server.Administration
_netMgr.RegisterNetMessage<MsgUpdateAdminStatus>(MsgUpdateAdminStatus.NAME);
// Cache permissions for loaded console commands with the requisite attributes.
foreach (var (cmdName, cmd) in _consoleShell.AvailableCommands)
foreach (var (cmdName, cmd) in _consoleHost.RegisteredCommands)
{
var (isAvail, flagsReq) = GetRequiredFlag(cmd);
@@ -420,7 +420,7 @@ namespace Content.Server.Administration
return false;
}
private static (bool isAvail, AdminFlags[] flagsReq) GetRequiredFlag(IClientCommand cmd)
private static (bool isAvail, AdminFlags[] flagsReq) GetRequiredFlag(IConsoleCommand cmd)
{
var type = cmd.GetType();
if (Attribute.IsDefined(type, typeof(AnyCommandAttribute)))