Remove bounds check for FTL (#14787)

This commit is contained in:
metalgearsloth
2023-03-24 17:17:08 +11:00
committed by GitHub
parent 64107023cf
commit dcbc094f94

View File

@@ -82,7 +82,7 @@ public sealed partial class ShuttleSystem
}
}
public bool CanFTL(EntityUid? uid, [NotNullWhen(false)] out string? reason, TransformComponent? xform = null)
public bool CanFTL(EntityUid? uid, [NotNullWhen(false)] out string? reason)
{
if (HasComp<PreventPilotComponent>(uid))
{
@@ -91,29 +91,6 @@ public sealed partial class ShuttleSystem
}
reason = null;
if (!TryComp<MapGridComponent>(uid, out var grid) ||
!Resolve(uid.Value, ref xform))
{
return true;
}
var bounds = _transform.GetWorldMatrix(xform).TransformBox(grid.LocalAABB).Enlarged(ShuttleFTLRange);
var bodyQuery = GetEntityQuery<PhysicsComponent>();
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
{
if (uid == other.Owner ||
!bodyQuery.TryGetComponent(other.Owner, out var body) ||
body.Mass < ShuttleFTLMassThreshold)
{
continue;
}
reason = Loc.GetString("shuttle-console-proximity");
return false;
}
return true;
}