Skip to content

Commit

Permalink
Align dungeon with largest grid (new-frontiers-14#1879)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatston3 authored Aug 18, 2024
1 parent 2b7039f commit 73c8c6e
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions Content.Server/Salvage/SpawnSalvageMissionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,29 +231,9 @@ protected override async Task<bool> Process()
Box2 shuttleBox = new Box2();

if (shuttleUid is { Valid: true } vesselUid &&
_entManager.TryGetComponent<TransformComponent>(vesselUid, out var vesselXform))
_entManager.TryGetComponent<MapGridComponent>(vesselUid, out var gridComp))
{
foreach (var gridUid in stationData.Grids)
{
if (!_entManager.TryGetComponent<MapGridComponent>(gridUid, out var gridComp))
continue;

MapCoordinates mapBottomLeft = _xforms.ToMapCoordinates(EntityCoordinatesExtensions.ToCoordinates(gridUid, gridComp.LocalAABB.BottomLeft));
MapCoordinates mapTopRight = _xforms.ToMapCoordinates(EntityCoordinatesExtensions.ToCoordinates(gridUid, gridComp.LocalAABB.TopRight));
EntityCoordinates shuttleBottomLeft = _xforms.ToCoordinates((vesselUid, vesselXform), mapBottomLeft);
EntityCoordinates shuttleTopRight = _xforms.ToCoordinates((vesselUid, vesselXform), mapTopRight);

//IsEmpty check needed so box won't contain 0, 0
if (!shuttleBox.IsEmpty())
{
shuttleBox = shuttleBox.ExtendToContain(shuttleBottomLeft.Position);
shuttleBox = shuttleBox.ExtendToContain(shuttleTopRight.Position);
}
else
{
shuttleBox = new Box2(shuttleBottomLeft.Position, shuttleTopRight.Position);
}
}
shuttleBox = gridComp.LocalAABB;
}

// Frontier: offset ship spawn point from bounding boxes
Expand Down

0 comments on commit 73c8c6e

Please sign in to comment.