From 7f1a6012e1238903bc0e19c586c7187cedb6d9b1 Mon Sep 17 00:00:00 2001 From: soul Date: Mon, 30 Nov 2026 23:05:50 +0100 Subject: [PATCH] SeededLegsJoinOneFactionNearestFirst reads recipe draws from the equipment, not from StationWants Co-Authored-By: Claude Sonnet 5.5 --- tests/Aetheria.Shared.Tests/RegionLegsTests.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/RegionLegsTests.cs b/tests/Aetheria.Shared.Tests/RegionLegsTests.cs index 2838f6713..93206477f 100644 --- a/tests/Aetheria.Shared.Tests/RegionLegsTests.cs +++ b/tests/Aetheria.Shared.Tests/RegionLegsTests.cs @@ -20,6 +20,11 @@ public sealed partial class RunStartTests _cache.GetAll().Where(order => order.Commitment == RegionLegs.Commitment) .Select(order => (order.From.Key.Value + ">" + order.To.Key.Value, order)); + // What a station's recipes draw, read here from its equipment and the catalog, not from StationWants: the crew's table is not in it. + private IEnumerable RecipeDraws(OrbitalEntity station) => + station.Equipment.Select(unit => unit.EquippableItem.Data.Key).Distinct().SelectMany(design => Production.RunList(_cache, design)) + .SelectMany(recipe => Production.Draws(_cache, recipe)).Distinct().ToArray(); + private static IEnumerable<(GalaxyZone Zone, OrbitalEntity Station)> RegionStations(Galaxy galaxy) => galaxy.Zones.SelectMany(zone => zone.Contents.Entities.OfType().Where(entity => entity.Kind.IsSet() && entity.OrbitData.IsSet()).Select(station => (zone, station))); @@ -44,7 +49,7 @@ public sealed partial class RunStartTests Assert.Same(At(order.From.Key).Faction, At(order.To.Key).Faction); Assert.Equal(order.Goods.Select(good => good.Key.Value).OrderBy(v => v, StringComparer.Ordinal), order.Goods.Select(good => good.Key.Value)); Assert.Empty(order.Goods.Select(good => good.Key).Intersect(StationWants.Makes(At(order.To.Key)))); - Assert.Empty(order.Goods.Select(good => good.Key).Except(StationWants.Consumed(At(order.To.Key)))); + Assert.Empty(order.Goods.Select(good => good.Key).Except(RecipeDraws(At(order.To.Key)))); } var expectedGoods = 0; for (var s = 0; s < stations.Length; s++) @@ -52,7 +57,7 @@ public sealed partial class RunStartTests var (zone, station) = stations[s]; if (station.Faction == null) continue; var makes = StationWants.Makes(station); - foreach (var good in StationWants.Consumed(station).Where(good => !makes.Contains(good))) + foreach (var good in RecipeDraws(station).Where(good => !makes.Contains(good))) { var producers = stations.Select((x, index) => (x.Zone, x.Station, index)).Where(x => x.Station != station && x.Station.Faction == station.Faction && StationWants.Makes(x.Station).Contains(good)).ToArray();