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

@ -34,6 +34,10 @@ public static class Extensions
totalWeight += weights[x];
}
// Nothing can be drawn from a set whose weights all come to nothing. Returning an empty array says so,
// where a full array of unset elements would read as "found these" and hand the caller nulls.
if (totalWeight <= 0) return new T[0];
var randomElements = new T[count];
for (int i = 0; i < count; i++)
{