Add cargo shuttle (#8686)

This commit is contained in:
metalgearsloth
2022-06-23 14:36:47 +10:00
committed by GitHub
parent b56b737b67
commit 77a8e16104
99 changed files with 4064 additions and 1356 deletions

View File

@@ -187,17 +187,26 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
// TODO: Make this a prototype
var map = "/Maps/infiltrator.yml";
var aabbs = _stationSystem.Stations.SelectMany(x =>
Comp<StationDataComponent>(x).Grids.Select(x => _mapManager.GetGridComp(x).Grid.WorldAABB)).ToArray();
var aabb = aabbs[0];
for (int i = 1; i < aabbs.Length; i++)
var center = new Vector2();
var minRadius = 0f;
Box2? aabb = null;
foreach (var uid in _stationSystem.Stations)
{
aabb.Union(aabbs[i]);
var grid = Comp<IMapGridComponent>(uid).Grid;
aabb = aabb?.Union(grid.WorldAABB) ?? grid.WorldAABB;
}
if (aabb != null)
{
center = aabb.Value.Center;
minRadius = MathF.Max(aabb.Value.Width, aabb.Value.Height);
}
var (_, gridId) = _mapLoader.LoadBlueprint(GameTicker.DefaultMap, map, new MapLoadOptions
{
Offset = aabb.Center + MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * 2.5f
Offset = center + MathF.Max(minRadius, minRadius) + 1000f,
});
if (!gridId.HasValue)