Fix station docking bays, save-safe instance keys, and zero-weight draws

One rule now governs interior space: an empty hardpoint cell is usable, in
both UnoccupiedSpace and ItemFits. ItemFits used to refuse hardpoint cells
that UnoccupiedSpace offered, so stations failed to equip a docking bay.

CraftedItemInstance.Ingredients and Product move from keys 3 and 4 to 9 and
10, past every key the derived instances use. At 3 and 4 an older save reads
nil into a non-nullable Guid and fails to load.

WeightedRandomElements returns an empty array when every weight is zero,
instead of an array of nulls. LoadoutGenerator treats a missing Galaxy as
"every product available", the seam a fixture needs to generate loadouts
without a galaxy. ZoneGenerator skips a story station that fails to generate
and logs it, instead of throwing.

Verified: Aetheria.Shared and tools/AetherDb build headless; Unity 6000.3.24f1
batchmode compile succeeds; AetherDb doctor, station-fit and loadout pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-12 23:22:36 +02:00
commit 6bd3e17690
5 changed files with 25 additions and 12 deletions

View file

@ -146,14 +146,16 @@ public class LoadoutGenerator
count);
}
// 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.
private bool IsAvailable(FactionProductData product) =>
Galaxy.IsPrelude ||
Galaxy == null || Galaxy.IsPrelude ||
Galaxy.ContainsFaction(product.Manufacturer) && (Faction == null || Faction.Allegiance.ContainsKey(product.Manufacturer));
// Prioritize products from the zone faction and its allies, penalizing distance to the manufacturer's headquarters
private float ManufacturerPreference(Guid manufacturer)
{
if (Faction == null) return 1;
if (Faction == null || Galaxy == null) return 1;
var allegiance = manufacturer == Faction.ID ? 1 :
Faction.Allegiance.TryGetValue(manufacturer, out var a) ? a : 0;
var home = Galaxy.HomeZones.FirstOrDefault(h => h.Key.ID == manufacturer).Value;