From 4c298c243a105ad4e358130bd0dad4ee2e21b356 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 28 Jul 2022 23:30:42 +1000 Subject: [PATCH] Don't allow nullspace FTL (#10110) * Don't allow nullspace FTL Because other systems are my problemo now. * Also this --- .../Systems/ShuttleSystem.FasterThanLight.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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()) {