diff --git a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs index aabfaa31dd8..7c3b2f710ee 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs @@ -6,6 +6,7 @@ using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; +using Content.Shared.Shuttles.Components; // Frontier namespace Content.Server.Shuttles.Systems; @@ -62,6 +63,11 @@ private bool CanDock( return false; } + // Frontier: check dock types + if ((shuttleDock.DockType & gridDock.DockType) == DockType.None) + return false; + // End Frontier + // First, get the station dock's position relative to the shuttle, this is where we rotate it around var stationDockPos = shuttleDockXform.LocalPosition + shuttleDockXform.LocalRotation.RotateVec(new Vector2(0f, -1f)); @@ -111,12 +117,12 @@ private bool CanDock( /// Tries to get a valid docking configuration for the shuttle to the target grid. /// /// Priority docking tag to prefer, e.g. for emergency shuttle - public DockingConfig? GetDockingConfig(EntityUid shuttleUid, EntityUid targetGrid, string? priorityTag = null) + public DockingConfig? GetDockingConfig(EntityUid shuttleUid, EntityUid targetGrid, string? priorityTag = null, DockType dockType = DockType.Airlock) // Frontier: add dockType { var gridDocks = GetDocks(targetGrid); var shuttleDocks = GetDocks(shuttleUid); - return GetDockingConfigPrivate(shuttleUid, targetGrid, shuttleDocks, gridDocks, priorityTag); + return GetDockingConfigPrivate(shuttleUid, targetGrid, shuttleDocks, gridDocks, priorityTag, dockType); // Frontier: add dockType } /// @@ -125,12 +131,13 @@ private bool CanDock( public DockingConfig? GetDockingConfigAt(EntityUid shuttleUid, EntityUid targetGrid, EntityCoordinates coordinates, - Angle angle) + Angle angle, + DockType dockType = DockType.Airlock) // Frontier { var gridDocks = GetDocks(targetGrid); var shuttleDocks = GetDocks(shuttleUid); - var configs = GetDockingConfigs(shuttleUid, targetGrid, shuttleDocks, gridDocks); + var configs = GetDockingConfigs(shuttleUid, targetGrid, shuttleDocks, gridDocks, dockType); // Frontier: add dockType foreach (var config in configs) { @@ -150,7 +157,8 @@ private List GetDockingConfigs( EntityUid shuttleUid, EntityUid targetGrid, List> shuttleDocks, - List> gridDocks) + List> gridDocks, + DockType dockType) // Frontier: add dockType { var validDockConfigs = new List(); @@ -173,10 +181,20 @@ private List GetDockingConfigs( { var shuttleDockXform = _xformQuery.GetComponent(dockUid); + // Frontier: skip docks that don't match type + if ((shuttleDock.DockType & dockType) == DockType.None) + continue; + // End Frontier + foreach (var (gridDockUid, gridDock) in gridDocks) { var gridXform = _xformQuery.GetComponent(gridDockUid); + // Frontier: skip docks that don't match type + if ((gridDock.DockType & dockType) == DockType.None) + continue; + // End Frontier + if (!CanDock( shuttleDock, shuttleDockXform, gridDock, gridXform, @@ -223,11 +241,21 @@ private List GetDockingConfigs( if (other == shuttleDock) continue; + // Frontier: skip docks that don't match type + if ((other.DockType & dockType) == DockType.None) + continue; + // End Frontier + foreach (var (otherGridUid, otherGrid) in gridDocks) { if (otherGrid == gridDock) continue; + // Frontier: skip docks that don't match type + if ((otherGrid.DockType & dockType) == DockType.None) + continue; + // End Frontier + if (!CanDock( other, _xformQuery.GetComponent(otherUid), @@ -277,9 +305,10 @@ private List GetDockingConfigs( EntityUid targetGrid, List> shuttleDocks, List> gridDocks, - string? priorityTag = null) + string? priorityTag = null, + DockType dockType = DockType.Airlock) // Frontier { - var validDockConfigs = GetDockingConfigs(shuttleUid, targetGrid, shuttleDocks, gridDocks); + var validDockConfigs = GetDockingConfigs(shuttleUid, targetGrid, shuttleDocks, gridDocks, dockType); // Frontier: add dockType if (validDockConfigs.Count <= 0) return null; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 2d7a64cf9e3..f876ffd3e43 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -712,9 +712,10 @@ public bool TryFTLDock( EntityUid shuttleUid, ShuttleComponent component, EntityUid targetUid, - string? priorityTag = null) + string? priorityTag = null, + DockType dockType = DockType.Airlock) // Frontier { - return TryFTLDock(shuttleUid, component, targetUid, out _, priorityTag); + return TryFTLDock(shuttleUid, component, targetUid, out _, priorityTag, dockType); // Frontier: add dockType } /// @@ -726,7 +727,8 @@ public bool TryFTLDock( ShuttleComponent component, EntityUid targetUid, [NotNullWhen(true)] out DockingConfig? config, - string? priorityTag = null) + string? priorityTag = null, + DockType dockType = DockType.Airlock) // Frontier { config = null; @@ -738,7 +740,7 @@ public bool TryFTLDock( return false; } - config = _dockSystem.GetDockingConfig(shuttleUid, targetUid, priorityTag); + config = _dockSystem.GetDockingConfig(shuttleUid, targetUid, priorityTag, dockType); // Frontier: add dockType if (config != null) {