Add docking command (#6303)
This commit is contained in:
54
Content.Server/Shuttles/DockCommand.cs
Normal file
54
Content.Server/Shuttles/DockCommand.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
using Content.Server.Administration;
|
||||||
|
using Content.Server.Shuttles.Components;
|
||||||
|
using Content.Server.Shuttles.EntitySystems;
|
||||||
|
using Content.Shared.Administration;
|
||||||
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -320,7 +320,7 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Docks 2 ports together and assumes it is valid.
|
/// Docks 2 ports together and assumes it is valid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Dock(DockingComponent dockA, DockingComponent dockB)
|
public void Dock(DockingComponent dockA, DockingComponent dockB)
|
||||||
{
|
{
|
||||||
Logger.DebugS("docking", $"Docking between {dockA.Owner} and {dockB.Owner}");
|
Logger.DebugS("docking", $"Docking between {dockA.Owner} and {dockB.Owner}");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user