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,9 +1,10 @@
using System;
using Content.Client.GameObjects.Components;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.Interfaces;
using Content.Shared.GameObjects;
using Robust.Client.Interfaces.Console;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Console;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -17,12 +18,10 @@ namespace Content.Client.Commands
public string Description => "Toggles visibility of markers such as spawn points.";
public string Help => "";
public bool Execute(IDebugConsole console, params string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
EntitySystem.Get<MarkerSystem>()
.MarkersVisible ^= true;
return false;
}
}
@@ -33,12 +32,10 @@ namespace Content.Client.Commands
public string Description => "Makes entities below the floor always visible.";
public string Help => $"Usage: {Command}";
public bool Execute(IDebugConsole console, params string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
EntitySystem.Get<SubFloorHideSystem>()
.EnableAll ^= true;
return false;
}
}
@@ -49,7 +46,7 @@ namespace Content.Client.Commands
public string Description => "Makes entities below the floor always visible until the client is restarted.";
public string Help => $"Usage: {Command}";
public bool Execute(IDebugConsole console, params string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
EntitySystem.Get<SubFloorHideSystem>()
.EnableAll = true;
@@ -64,8 +61,6 @@ namespace Content.Client.Commands
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
return false;
}
}
@@ -75,14 +70,12 @@ namespace Content.Client.Commands
public string Description => "Send a notify client side.";
public string Help => "notify <message>";
public bool Execute(IDebugConsole console, params string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var message = args[0];
var notifyManager = IoCManager.Resolve<IClientNotifyManager>();
notifyManager.PopupMessage(message);
return false;
}
}
@@ -92,18 +85,18 @@ namespace Content.Client.Commands
public string Description => "Creates and teleports you to a new uninitialized map for mapping.";
public string Help => $"Usage: {Command} <mapname> / {Command} <id> <mapname>";
public bool Execute(IDebugConsole console, params string[] args)
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length == 0)
{
console.AddLine(Help);
return false;
shell.WriteLine(Help);
return;
}
console.Commands["togglelight"].Execute(console);
console.Commands["showsubfloorforever"].Execute(console);
shell.ConsoleHost.RegisteredCommands["togglelight"].Execute(shell, string.Empty, Array.Empty<string>());
shell.ConsoleHost.RegisteredCommands["showsubfloorforever"].Execute(shell, string.Empty, Array.Empty<string>());
return true;
shell.RemoteExecuteCommand(argStr);
}
}
}