Fix replayghost spawning location (#30252)

Fix replayghost spawn
This commit is contained in:
Errant
2024-07-22 21:32:30 +02:00
committed by GitHub
parent 61fd8167e0
commit bf1450fdc8
18 changed files with 40 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Movement.Components;
using Content.Shared.Station.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -164,14 +165,25 @@ public sealed partial class ReplaySpectatorSystem
float? maxSize = null;
var gridQuery = EntityQueryEnumerator<MapGridComponent>();
var stationFound = false;
while (gridQuery.MoveNext(out var uid, out var grid))
{
var size = grid.LocalAABB.Size.LengthSquared();
if (maxSize == null || size > maxSize)
{
maxUid = (uid, grid);
maxSize = size;
}
if (maxSize is not null && size < maxSize)
continue;
var station = HasComp<StationMemberComponent>(uid);
if (!station && stationFound)
continue;
maxUid = (uid, grid);
maxSize = size;
if (station)
stationFound = true;
}
coords = new EntityCoordinates(maxUid ?? default, default);