Gear without presence: IsAvailable reaches by allegiance alone

Presence in the galaxy no longer gates gear (ruling gear-without-presence).
Delete the IsPrelude exception, Galaxy.ContainsFaction with its cache, and
the AetherDb loadout exclude-sellers mode that existed to exercise the
presence gate. An absent maker weighs as one jump beyond the farthest zone
the generator's zone reaches. Not yet verified; may not build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-08 14:10:58 +02:00
commit 04d2947a80
6 changed files with 119 additions and 77 deletions

View file

@ -174,26 +174,30 @@ public class LoadoutGenerator
design.HardpointType == HardpointType.Tool || design.HardpointType == HardpointType.Hull ||
hulls.Any(hull => hull.Hardpoints.Any(hardpoint => hardpoint.Takes(design)));
// No galaxy means no availability to filter by: every product is on offer. A fixture generates loadouts that
// way, so a test can exercise placement and products without standing up a whole galaxy; no game path does.
// Loadouts.Materialize takes availability as a predicate; RunStart, the game's one preset spawner, passes this, so
// presets and generation share one availability rule. In a galaxy, a faction always reaches its own manufacturer's
// gear, and otherwise gear made by a manufacturer in that galaxy that its allegiance names (operator, 2026-09-30:
// allegiance lists only other factions).
// No galaxy, or no faction, means no allegiance to filter by: every product is on offer. A fixture generates
// loadouts that way, so a test can exercise placement and products without standing up a whole galaxy; a scenario
// stage has no faction and reaches every maker. Loadouts.Materialize takes availability as a predicate; RunStart,
// the game's one preset spawner, passes this, so presets and generation share one availability rule. A faction
// always reaches its own manufacturer's gear, and otherwise gear made by a manufacturer its allegiance names
// (operator, 2026-09-30: allegiance lists only other factions). Whether that manufacturer is present in the galaxy
// does not matter (operator, 2026-10-06: a faction need not be present for its gear to be available).
public bool IsAvailable(FactionProductData product) =>
Galaxy == null || Galaxy.IsPrelude ||
Faction != null && ItemManager.ItemData.Get(product.Manufacturer) == Faction ||
Galaxy.ContainsFaction(product.Manufacturer) && (Faction == null || Faction.Allegiance.ContainsKey(product.Manufacturer));
Galaxy == null || Faction == null ||
ItemManager.ItemData.Get(product.Manufacturer) == Faction || Faction.Allegiance.ContainsKey(product.Manufacturer);
// Prioritize products from the zone faction and its allies, penalizing distance to the manufacturer's headquarters
private float ManufacturerPreference(CultRecordRef<Faction> manufacturer)
// Prioritize products from the zone faction and its allies, penalizing distance to the manufacturer's headquarters.
// A manufacturer with no home zone in this galaxy weighs as if its headquarters lay one jump beyond the farthest
// zone this zone reaches: reachable through allegiance, least preferred.
public float ManufacturerPreference(CultRecordRef<Faction> manufacturer)
{
if (Faction == null || Galaxy == null) return 1;
var maker = ItemManager.ItemData.Get(manufacturer);
var allegiance = maker == Faction ? 1 :
Faction.Allegiance.TryGetValue(manufacturer, out var a) ? a : 0;
var home = maker != null && Galaxy.HomeZones.TryGetValue(maker, out var h) ? h : null;
var distance = home != null && Zone?.Distance != null && Zone.Distance.TryGetValue(home, out var d) ? d : 0;
var distance = Zone?.Distance == null ? 0 :
home != null && Zone.Distance.TryGetValue(home, out var d) ? d :
home == null && Zone.Distance.Count > 0 ? Zone.Distance.Values.Max() + 1 : 0;
return allegiance / (1 + distance);
}