Don't allow nullspace FTL (#10110)

* Don't allow nullspace FTL

Because other systems are my problemo now.

* Also this
This commit is contained in:
metalgearsloth 2022-07-28 23:30:42 +10:00 committed by GitHub
parent ac67ae7b1e
commit 4c298c243a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 4 deletions

View File

@ -411,7 +411,11 @@ public sealed partial class ShuttleSystem
{
if (!TryComp<TransformComponent>(component.Owner, out var xform) ||
!TryComp<TransformComponent>(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
/// </summary>
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<TransformComponent>();
var shuttleAABB = Comp<IMapGridComponent>(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())
{