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:
@@ -1,25 +1,25 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public class DeleteComponent : IClientCommand
|
||||
public class DeleteComponent : IConsoleCommand
|
||||
{
|
||||
public string Command => "deletecomponent";
|
||||
public string Description => "Deletes all instances of the specified component.";
|
||||
public string Help => $"Usage: {Command} <name>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
switch (args.Length)
|
||||
{
|
||||
case 0:
|
||||
shell.SendText(player, $"Not enough arguments.\n{Help}");
|
||||
shell.WriteLine($"Not enough arguments.\n{Help}");
|
||||
break;
|
||||
default:
|
||||
var name = string.Join(" ", args);
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (!componentFactory.TryGetRegistration(name, out var registration))
|
||||
{
|
||||
shell.SendText(player, $"No component exists with name {name}.");
|
||||
shell.WriteLine($"No component exists with name {name}.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands
|
||||
i++;
|
||||
}
|
||||
|
||||
shell.SendText(player, $"Removed {i} components with name {name}.");
|
||||
shell.WriteLine($"Removed {i} components with name {name}.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user