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

@@ -3,8 +3,8 @@ using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage;
using Content.Shared.Administration;
using Content.Shared.Roles;
using Robust.Server.Interfaces.Console;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -14,7 +14,7 @@ using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Admin)]
class SetOutfitCommand : IClientCommand
class SetOutfitCommand : IConsoleCommand
{
public string Command => "setoutfit";
@@ -22,17 +22,17 @@ namespace Content.Server.Administration.Commands
public string Help => Loc.GetString("Usage: {0} <entityUid> | {0} <entityUid> <outfitId>", Command);
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length < 1)
{
shell.SendText(player, Loc.GetString("Wrong number of arguments."));
shell.WriteLine(Loc.GetString("Wrong number of arguments."));
return;
}
if (!int.TryParse(args[0], out var entityUid))
{
shell.SendText(player, Loc.GetString("EntityUid must be a number."));
shell.WriteLine(Loc.GetString("EntityUid must be a number."));
return;
}
@@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands
if (!eUid.IsValid() || !entityManager.EntityExists(eUid))
{
shell.SendText(player, Loc.GetString("Invalid entity ID."));
shell.WriteLine(Loc.GetString("Invalid entity ID."));
return;
}
@@ -50,7 +50,7 @@ namespace Content.Server.Administration.Commands
if (!target.TryGetComponent<InventoryComponent>(out var inventoryComponent))
{
shell.SendText(player, Loc.GetString("Target entity does not have an inventory!"));
shell.WriteLine(Loc.GetString("Target entity does not have an inventory!"));
return;
}
@@ -58,6 +58,7 @@ namespace Content.Server.Administration.Commands
{
var eui = IoCManager.Resolve<EuiManager>();
var ui = new SetOutfitEui(target);
var player = shell.Player as IPlayerSession;
eui.OpenEui(ui, player);
return;
}
@@ -65,7 +66,7 @@ namespace Content.Server.Administration.Commands
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
if (!prototypeManager.TryIndex<StartingGearPrototype>(args[1], out var startingGear))
{
shell.SendText(player, Loc.GetString("Invalid outfit id"));
shell.WriteLine(Loc.GetString("Invalid outfit id"));
return;
}