Content changes for mapgrid kill (#12567)

This commit is contained in:
metalgearsloth
2022-11-22 13:12:04 +11:00
committed by GitHub
parent 9170e7ac9d
commit 6c76061887
75 changed files with 192 additions and 123 deletions

View File

@@ -15,6 +15,7 @@ using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
namespace Content.Server.Shuttles.Systems;
@@ -95,7 +96,7 @@ public sealed partial class ShuttleSystem
return true;
}
var bounds = xform.WorldMatrix.TransformBox(grid.Grid.LocalAABB).Enlarged(ShuttleFTLRange);
var bounds = xform.WorldMatrix.TransformBox(grid.LocalAABB).Enlarged(ShuttleFTLRange);
var bodyQuery = GetEntityQuery<PhysicsComponent>();
foreach (var other in _mapManager.FindGridsIntersecting(xform.MapID, bounds))
@@ -226,7 +227,7 @@ public sealed partial class ShuttleSystem
comp.State = FTLState.Travelling;
var width = Comp<MapGridComponent>(comp.Owner).Grid.LocalAABB.Width;
var width = Comp<MapGridComponent>(comp.Owner).LocalAABB.Width;
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value), new Vector2(_index + width / 2f, 0f));
xform.LocalRotation = Angle.Zero;
_index += width + Buffer;
@@ -458,13 +459,13 @@ public sealed partial class ShuttleSystem
}
var xformQuery = GetEntityQuery<TransformComponent>();
var shuttleAABB = Comp<MapGridComponent>(component.Owner).Grid.LocalAABB;
var shuttleAABB = Comp<MapGridComponent>(component.Owner).LocalAABB;
// 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).Grid.LocalAABB).Enlarged(shuttleAABB.Size.Length);
.TransformBox(Comp<MapGridComponent>(targetUid).LocalAABB).Enlarged(shuttleAABB.Size.Length);
var nearbyGrids = new HashSet<EntityUid>(1) { targetUid };
var iteration = 0;
@@ -478,7 +479,7 @@ public sealed partial class ShuttleSystem
if (!nearbyGrids.Add(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
}
// Can do proximity
@@ -501,7 +502,7 @@ public sealed partial class ShuttleSystem
if (nearbyGrids.Contains(grid.GridEntityId)) continue;
targetAABB = targetAABB.Union(_transform.GetWorldMatrix(grid.GridEntityId, xformQuery)
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).Grid.LocalAABB));
.TransformBox(Comp<MapGridComponent>(grid.GridEntityId).LocalAABB));
}
break;