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,23 +1,24 @@
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
class RespawnCommand : IClientCommand
|
||||
class RespawnCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "respawn";
|
||||
public string Description => "Respawns a player, kicking them back to the lobby.";
|
||||
public string Help => "respawn [player]";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
if (args.Length > 1)
|
||||
{
|
||||
shell.SendText(player, "Must provide <= 1 argument.");
|
||||
shell.WriteLine("Must provide <= 1 argument.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
shell.SendText((IPlayerSession)null, "If not a player, an argument must be given.");
|
||||
shell.WriteLine("If not a player, an argument must be given.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.Commands.GameTicking
|
||||
}
|
||||
else if (!playerMgr.TryGetUserId(args[0], out userId))
|
||||
{
|
||||
shell.SendText(player, "Unknown player");
|
||||
shell.WriteLine("Unknown player");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -45,17 +46,16 @@ namespace Content.Server.Commands.GameTicking
|
||||
{
|
||||
if (!playerMgr.TryGetPlayerData(userId, out var data))
|
||||
{
|
||||
shell.SendText(player, "Unknown player");
|
||||
shell.WriteLine("Unknown player");
|
||||
return;
|
||||
}
|
||||
|
||||
data.ContentData().WipeMind();
|
||||
shell.SendText(player,
|
||||
"Player is not currently online, but they will respawn if they come back online");
|
||||
shell.WriteLine("Player is not currently online, but they will respawn if they come back online");
|
||||
return;
|
||||
}
|
||||
|
||||
ticker.Respawn(targetPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user