diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index af2928bb8a..98ccdb0b5c 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -411,7 +411,11 @@ public sealed partial class ShuttleSystem { if (!TryComp(component.Owner, out var xform) || !TryComp(targetUid, out var targetXform) || - targetXform.MapUid == null) return false; + targetXform.MapUid == null || + !targetXform.MapUid.Value.IsValid()) + { + return false; + } var config = GetDockingConfig(component, targetUid); @@ -439,7 +443,13 @@ public sealed partial class ShuttleSystem /// public bool TryFTLProximity(ShuttleComponent component, EntityUid targetUid, TransformComponent? xform = null, TransformComponent? targetXform = null) { - if (!Resolve(targetUid, ref targetXform) || targetXform.MapUid == null || !Resolve(component.Owner, ref xform)) return false; + if (!Resolve(targetUid, ref targetXform) || + targetXform.MapUid == null || + !targetXform.MapUid.Value.IsValid() || + !Resolve(component.Owner, ref xform)) + { + return false; + } var xformQuery = GetEntityQuery(); var shuttleAABB = Comp(component.Owner).Grid.LocalAABB; @@ -456,7 +466,7 @@ public sealed partial class ShuttleSystem var lastCount = 1; var mapId = targetXform.MapID; - while (iteration < 3) + while (iteration < FTLProximityIterations) { foreach (var grid in _mapManager.FindGridsIntersecting(mapId, targetAABB)) { @@ -477,7 +487,8 @@ public sealed partial class ShuttleSystem lastCount = nearbyGrids.Count; // Mishap moment, dense asteroid field or whatever - if (iteration != 3) continue; + if (iteration != FTLProximityIterations) + continue; foreach (var grid in _mapManager.GetAllGrids()) {