Files
RobustToolbox/Robust.Server/Console/Commands/SpawnCommand.cs
Acruid 3eb6e067f9 Console Unify (#1513)
* Renamed shared ICommand to IConsoleCommand.

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

# Conflicts:
#	Robust.Client/Console/Commands/Debug.cs

* Finally move shells and commands into shared.

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

* Pulled up ConsoleHost and Console shell into a shared context.

* Pulled up half the functions of ConsoleHost into a shared context.

* Repair rebase damage.

* Make LoadConsoleCommands function not remove any previously registered commands.
2021-02-01 16:40:26 -08:00

26 lines
869 B
C#

using Robust.Server.Interfaces.GameObjects;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Console;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
namespace Robust.Server.Console.Commands
{
public class SpawnCommand : IConsoleCommand
{
public string Command => "spawn";
public string Description => "Spawns an entity with specific type at your feet.";
public string Help => "spawn <entity type>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var ent = IoCManager.Resolve<IServerEntityManager>();
if (player?.AttachedEntity != null)
{
ent.SpawnEntity(args[0], player.AttachedEntity.Transform.Coordinates);
}
}
}
}