From 5010f199ad900256d05d51d1fdbc490c6b2e797e Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 6 Dec 2022 13:12:34 +1100 Subject: [PATCH] Add support for FTL points (#12891) --- .../Systems/ShuttleSystem.FasterThanLight.cs | 13 +++++++++++-- Resources/Prototypes/Entities/Markers/shuttle.yml | 8 ++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Resources/Prototypes/Entities/Markers/shuttle.yml diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index b32d50a065..b3e4742904 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -460,13 +460,22 @@ public sealed partial class ShuttleSystem var xformQuery = GetEntityQuery(); var shuttleAABB = Comp(component.Owner).LocalAABB; + Box2 targetLocalAABB; // Spawn nearby. // We essentially expand the Box2 of the target area until nothing else is added then we know it's valid. // Can't just get an AABB of every grid as we may spawn very far away. - var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery) - .TransformBox(Comp(targetUid).LocalAABB).Enlarged(shuttleAABB.Size.Length); + if (TryComp(targetUid, out var targetGrid)) + { + targetLocalAABB = targetGrid.LocalAABB; + } + else + { + targetLocalAABB = new Box2(); + } + var targetAABB = _transform.GetWorldMatrix(targetXform, xformQuery) + .TransformBox(targetLocalAABB).Enlarged(shuttleAABB.Size.Length); var nearbyGrids = new HashSet(1) { targetUid }; var iteration = 0; var lastCount = 1; diff --git a/Resources/Prototypes/Entities/Markers/shuttle.yml b/Resources/Prototypes/Entities/Markers/shuttle.yml new file mode 100644 index 0000000000..9ef9c0de5a --- /dev/null +++ b/Resources/Prototypes/Entities/Markers/shuttle.yml @@ -0,0 +1,8 @@ +- type: entity + id: FTLPoint + parent: MarkerBase + name: FTL point + components: + - type: FTLDestination + - type: Sprite + state: pink