2026-10-21 22:42:49 +02:00
|
|
|
using System.Collections.Generic;
|
Gravity: a wider zone fingerprint, one copied-rail helper, belts kinded at generation, adjacent belts pinned
ZoneFingerprint digests rock spin and periods, orbital entities (type, position, rail), other entities by type, the
pack radius, a 9x9 height grid at two times and optionally PopulatedRadius (finding fingerprint-omits).
TrojanSwarmTests.BaseDigest is repinned with it on Yggdrasil at C1's generator, swarms off.
BeltShapes.CopiedRail replaces StationPlacementTests.SwarmRail and the RidesRail slot filters of
ChildrenWithinReachTests: a rail a belt rides that copies a body's rail is never a placed slot.
The Zones fixture counts the belts the generator writes and those with no field kind, before Zone's own
FieldKinds.Ensure; EveryBeltIsKindedAtGeneration pins it at zero (finding ensure-unpinned).
AdjacentBeltsKeepTheirSpacing places two belts side by side and pins the second's inner edge a sibling spacing
outside the first's outer edge (follow-up belt-after-belt-edge-pin).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:36:35 +02:00
|
|
|
using System.Linq;
|
|
|
|
|
using GameCult.Caching;
|
|
|
|
|
|
2026-10-21 22:42:49 +02:00
|
|
|
// The belt shapes a test reads back from a built zone. A swarm's or a lane's rail is a copy of its host's rail (same Parent,
|
|
|
|
|
// Distance and Phase), never a slot Place laid out, so the tests that walk placed orbits leave copied rails out through this one
|
|
|
|
|
// helper.
|
Gravity: a wider zone fingerprint, one copied-rail helper, belts kinded at generation, adjacent belts pinned
ZoneFingerprint digests rock spin and periods, orbital entities (type, position, rail), other entities by type, the
pack radius, a 9x9 height grid at two times and optionally PopulatedRadius (finding fingerprint-omits).
TrojanSwarmTests.BaseDigest is repinned with it on Yggdrasil at C1's generator, swarms off.
BeltShapes.CopiedRail replaces StationPlacementTests.SwarmRail and the RidesRail slot filters of
ChildrenWithinReachTests: a rail a belt rides that copies a body's rail is never a placed slot.
The Zones fixture counts the belts the generator writes and those with no field kind, before Zone's own
FieldKinds.Ensure; EveryBeltIsKindedAtGeneration pins it at zero (finding ensure-unpinned).
AdjacentBeltsKeepTheirSpacing places two belts side by side and pins the second's inner edge a sibling spacing
outside the first's outer edge (follow-up belt-after-belt-edge-pin).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:36:35 +02:00
|
|
|
public static class BeltShapes
|
|
|
|
|
{
|
|
|
|
|
public static bool CopiedRail(Zone zone, CultRecordKey orbit)
|
|
|
|
|
{
|
|
|
|
|
if (!zone.Planets.Values.Any(b => b is AsteroidBeltData && b.Orbit.Key.Equals(orbit))) return false;
|
|
|
|
|
var rail = zone.Orbits[orbit].Data;
|
|
|
|
|
return zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => zone.Orbits[b.Orbit.Key].Data)
|
|
|
|
|
.Any(o => o.Parent.Key.Equals(rail.Parent.Key) && o.Distance == rail.Distance && o.Phase == rail.Phase);
|
|
|
|
|
}
|
2026-10-21 22:42:49 +02:00
|
|
|
|
|
|
|
|
// Every laned belt with its rail and its host: a belt on a copied rail that does not ride the rail (a swarm does), whose host
|
|
|
|
|
// is the body orbit the rail copies.
|
|
|
|
|
public static IEnumerable<(Orbit Host, Orbit Rail, AsteroidBelt Belt)> Lanes(Zone zone)
|
|
|
|
|
{
|
|
|
|
|
foreach (var (key, belt) in zone.AsteroidBelts.Where(b => !b.Value.Data.RidesRail))
|
|
|
|
|
{
|
|
|
|
|
var railKey = zone.Planets[key].Orbit.Key;
|
|
|
|
|
if (!CopiedRail(zone, railKey)) continue;
|
|
|
|
|
var rail = zone.Orbits[railKey];
|
|
|
|
|
var host = zone.Planets.Values.Where(b => !(b is AsteroidBeltData)).Select(b => zone.Orbits[b.Orbit.Key])
|
|
|
|
|
.Single(o => o.Data.Parent.Key.Equals(rail.Data.Parent.Key) && o.Data.Distance == rail.Data.Distance && o.Data.Phase == rail.Data.Phase);
|
|
|
|
|
yield return (host, rail, belt);
|
|
|
|
|
}
|
|
|
|
|
}
|
Gravity: a wider zone fingerprint, one copied-rail helper, belts kinded at generation, adjacent belts pinned
ZoneFingerprint digests rock spin and periods, orbital entities (type, position, rail), other entities by type, the
pack radius, a 9x9 height grid at two times and optionally PopulatedRadius (finding fingerprint-omits).
TrojanSwarmTests.BaseDigest is repinned with it on Yggdrasil at C1's generator, swarms off.
BeltShapes.CopiedRail replaces StationPlacementTests.SwarmRail and the RidesRail slot filters of
ChildrenWithinReachTests: a rail a belt rides that copies a body's rail is never a placed slot.
The Zones fixture counts the belts the generator writes and those with no field kind, before Zone's own
FieldKinds.Ensure; EveryBeltIsKindedAtGeneration pins it at zero (finding ensure-unpinned).
AdjacentBeltsKeepTheirSpacing places two belts side by side and pins the second's inner edge a sibling spacing
outside the first's outer edge (follow-up belt-after-belt-edge-pin).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:36:35 +02:00
|
|
|
}
|