Add support for FTL points (#12891)

This commit is contained in:
metalgearsloth 2022-12-06 13:12:34 +11:00 committed by GitHub
parent 10a99617b8
commit 5010f199ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -460,13 +460,22 @@ public sealed partial class ShuttleSystem
var xformQuery = GetEntityQuery<TransformComponent>();
var shuttleAABB = Comp<MapGridComponent>(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<MapGridComponent>(targetUid).LocalAABB).Enlarged(shuttleAABB.Size.Length);
if (TryComp<MapGridComponent>(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<EntityUid>(1) { targetUid };
var iteration = 0;
var lastCount = 1;

View File

@ -0,0 +1,8 @@
- type: entity
id: FTLPoint
parent: MarkerBase
name: FTL point
components:
- type: FTLDestination
- type: Sprite
state: pink