mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* 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.
30 lines
1009 B
C#
30 lines
1009 B
C#
using JetBrains.Annotations;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Robust.Client.Console.Commands
|
|
{
|
|
[UsedImplicitly]
|
|
internal sealed class ClientSpawnCommand : IConsoleCommand
|
|
{
|
|
public string Command => "cspawn";
|
|
public string Description => "Spawns a client-side entity with specific type at your feet.";
|
|
public string Help => "cspawn <entity type>";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var player = IoCManager.Resolve<IPlayerManager>().LocalPlayer;
|
|
if (player?.ControlledEntity == null)
|
|
{
|
|
shell.WriteLine("You don't have an attached entity.");
|
|
return;
|
|
}
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
|
entityManager.SpawnEntity(args[0], player.ControlledEntity.Transform.Coordinates);
|
|
}
|
|
}
|
|
}
|