SeededLegsJoinOneFactionNearestFirst reads recipe draws from the equipment, not from StationWants
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
56f8fce8e9
commit
7f1a6012e1
1 changed files with 7 additions and 2 deletions
|
|
@ -20,6 +20,11 @@ public sealed partial class RunStartTests
|
|||
_cache.GetAll<HaulOrderData>().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<CultRecordKey> 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<OrbitalEntity>().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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue