Files
tbd-station-14/Content.Server/Shuttles/DockCommand.cs
metalgearsloth 1e82d0c7ed Add docking window to shuttle consoles (#8756)
* lewd

* A

* Realtime

* Sleepy dork

* Draw radar position

* Accurate infiltrator

* experiments

* Better drawing

* Labels

* I need aan adult

* Cleanup

* Show toggles

* display I guess

* A

* fix

* fix

* cleanupsies

* Bit more polish

* Make sure mass scanners actually work

* Remove dummy state

* fren

* opposite

* aghost crash

* comment

* What's in a name

* woops

* Show docking ports

* Dock highlighting

* Drawing dock

* Shitty docks

* Lots of docking drawing

* Autodock working

* dork

* More graceful shutdown

* zoomies

* Lines and distance change

* revert

* Good enough

* cleanup

* Fix default range

* Dock UI and loc update

* Update on undock

* Loc fixes
2022-06-16 15:28:16 +10:00

53 lines
1.6 KiB
C#

using Content.Server.Administration;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Shuttles;
[AdminCommand(AdminFlags.Mapping)]
public sealed class DockCommand : IConsoleCommand
{
public string Command => "dock";
public string Description => $"Attempts to dock 2 airlocks together. Doesn't check whether it is valid.";
public string Help => $"{Command} <airlock entityuid1> <airlock entityuid2>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 2)
{
shell.WriteError($"Invalid number of args supplied");
return;
}
if (!EntityUid.TryParse(args[0], out var airlock1))
{
shell.WriteError($"Invalid EntityUid {args[0]}");
return;
}
if (!EntityUid.TryParse(args[1], out var airlock2))
{
shell.WriteError($"Invalid EntityUid {args[1]}");
return;
}
var entManager = IoCManager.Resolve<IEntityManager>();
if (!entManager.TryGetComponent(airlock1, out DockingComponent? dock1))
{
shell.WriteError($"No docking component found on {airlock1}");
return;
}
if (!entManager.TryGetComponent(airlock2, out DockingComponent? dock2))
{
shell.WriteError($"No docking component found on {airlock2}");
return;
}
var dockSystem = EntitySystem.Get<DockingSystem>();
dockSystem.Dock(dock1, dock2);
}
}