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 <noreply@anthropic.com>
This commit is contained in:
parent
9bca18b07c
commit
ddf0b4ec5a
1 changed files with 10 additions and 1 deletions
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue