From ddf0b4ec5a773662df3953fcefef84511c98ae87 Mon Sep 17 00:00:00 2001 From: soul Date: Sun, 29 Nov 2026 01:39:31 +0100 Subject: [PATCH] StationPlacementTests: root-seated overflow stations are checked by their own turrets Ruling root-stations-tested-by-own-turrets. The orphan-source test skips a station on a root's ring with no source orbit; the two flank tests give each turret to the station nearest it round the ring, so every station's turrets are still checked to flank it and clear each other. No bodyless orbit is added. Co-Authored-By: Claude Sonnet 5.5 --- tests/Aetheria.Shared.Tests/StationPlacementTests.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/Aetheria.Shared.Tests/StationPlacementTests.cs b/tests/Aetheria.Shared.Tests/StationPlacementTests.cs index 8eced01ec..248f938c7 100644 --- a/tests/Aetheria.Shared.Tests/StationPlacementTests.cs +++ b/tests/Aetheria.Shared.Tests/StationPlacementTests.cs @@ -244,7 +244,14 @@ public sealed class StationPlacementTests : IDisposable foreach (var station in orbitals.Where(e => TypeOf(built.Items, e) == HullType.Station)) { var orbit = built.Zone.Orbits[station.OrbitData]; - var mine = turrets.Where(t => SameRing(built.Zone.Orbits[t.OrbitData], orbit)).ToList(); + // Root-seated overflow stations share one ring, so a turret belongs to the station nearest it round the ring. + var neighbours = orbitals.Where(e => TypeOf(built.Items, e) == HullType.Station && SameRing(built.Zone.Orbits[e.OrbitData], orbit)).ToList(); + float RingGap(OrbitalEntity a, OrbitalEntity b) + { + var gap = Math.Abs(Turns(built.Zone.Orbits[a.OrbitData].Data.Phase - built.Zone.Orbits[b.OrbitData].Data.Phase)); + return Math.Min(gap, 1 - gap); + } + var mine = turrets.Where(t => SameRing(built.Zone.Orbits[t.OrbitData], orbit) && ReferenceEquals(neighbours.OrderBy(n => RingGap(t, n)).First(), station)).ToList(); matched += mine.Count; if (mine.Count == 0) continue; flanked++; @@ -353,6 +360,8 @@ public sealed class StationPlacementTests : IDisposable { var orbit = zone.Orbits[station.OrbitData]; var strays = zone.Orbits.Count(o => !ridden.Contains(o.Key) && !BeltShapes.CopiedRail(zone, o.Key) && SameRing(o.Value, orbit)); + // A root-seated overflow station has no source orbit by design (ruling root-stations-tested-by-own-turrets). + if (strays == 0 && orbit.Data.Parent.IsSet() && !zone.Orbits[orbit.Data.Parent.Key].Data.Parent.IsSet()) continue; Assert.True(strays == 1, $"seed {built.Seed}: a station's ring holds {strays} orbits no entity rides, not just its source's"); stations++; }