EconomyLoop boots the catalog the game boots (first-party packages composed): the Pirates' station hulls are a package's. The declaration test launches the demo in its own galaxy

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-28 11:12:01 +01:00
commit ffb5d73f81
2 changed files with 11 additions and 3 deletions

View file

@ -791,8 +791,11 @@ public sealed partial class RunStartTests
Assert.Equal(0, StationsOf(natural));
Assert.True(StationsOf(forced) >= 1);
// Through RunStart, the scenario's declaration is what reaches the generator.
Assert.Equal(2, StationsOf(RunStart.GenerateArena(_items, _zoneSettings, _planetSettings, _galaxy, new DemoTerminus())));
// Through RunStart, the scenario's declaration is what reaches the generator: the demo, in its own galaxy (the fixture's cast has
// no Pirates), holds both stations.
var (_, demoArena, _, failures) = Launch(new DemoTerminus());
Assert.True(failures.Count == 0, string.Join("; ", failures));
Assert.Equal(2, demoArena.Entities.OfType<OrbitalEntity>().Count(entity => entity.HullData.HullType == HullType.Station));
Assert.Equal(0, StationsOf(RunStart.GenerateArena(_items, _zoneSettings, _planetSettings, _galaxy, new MainGalaxy())));
// An order the galaxy or the catalog cannot meet is refused by name, never placed as something else.

View file

@ -120,7 +120,12 @@ public static class EconomyLoop
var catalog = Path.Combine(scratch, "Aetheria.cc");
File.Copy(Path.Combine(root, "GameData", "Aetheria.cc"), catalog);
new FileInfo(catalog).IsReadOnly = false;
using var cache = AetheriaStores.Open(catalog, runPath: Path.Combine(scratch, "run.cc"));
// The catalog the game boots: the first-party packages in GameData/Mods composed over the copy (the Pirates' station hulls
// are a package's), read from a derived file in the scratch, never written back to the shipped one.
var (composed, excluded) = ShipModCatalog.ResolveCatalog(catalog, Path.Combine(scratch, "derived.cc"), Path.Combine(root, "GameData", "Mods"));
if (excluded.Length > 0)
throw new InvalidOperationException("First-party packages were excluded from the catalog: " + string.Join("; ", excluded.Select(entry => entry.Package + ": " + entry.Reason)));
using var cache = AetheriaStores.Open(composed, runPath: Path.Combine(scratch, "run.cc"));
var authored = AuthoredSettings.Load(root);
var items = new ItemManager(1u, cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
var zoneSettings = authored.Read<ZoneGenerationSettings>("ZoneSettings");