Files
tbd-station-14/Content.Server/Administration/Commands/ExplosionCommand.cs
Acruid 8b5d66050a 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.
2021-02-01 16:49:43 -08:00

43 lines
1.4 KiB
C#

using Content.Server.Explosions;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
#nullable enable
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Fun)]
public sealed class ExplosionCommand : IConsoleCommand
{
public string Command => "explode";
public string Description => "Train go boom";
public string Help => "Usage: explode <x> <y> <dev> <heavy> <light> <flash>\n" +
"The explosion happens on the same map as the user.";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
if (player?.AttachedEntity == null)
{
shell.WriteLine("You must have an attached entity.");
return;
}
var x = float.Parse(args[0]);
var y = float.Parse(args[1]);
var dev = int.Parse(args[2]);
var hvy = int.Parse(args[3]);
var lgh = int.Parse(args[4]);
var fla = int.Parse(args[5]);
var mapTransform = player.AttachedEntity.Transform.GetMapTransform();
var coords = new EntityCoordinates(mapTransform.Owner.Uid, x, y);
ExplosionHelper.SpawnExplosion(coords, dev, hvy, lgh, fla);
}
}
}