determinism-ledger: every ItemManager states its seed; scatter on the zone's dice

- ItemManager(uint seed, ...) refuses seed 0 and seeds Random from it.
- RunStart.ItemSeed(galaxy, step) is public (formula unchanged), refuses a
  zero result; named steps ArenaStep, StageStep, ContinueStep and NoRunSeed.
- Continue seeds the item stream from the saved run's seed (ContinueStep);
  a scene with no galaxy uses NoRunSeed.
- Zone's unpack scatter draws SimulationDice.For(CombatSeed, ScatterStream,
  1-based pack ordinal), never the item stream.
- Loadout's scratch manager and AetherDb's catalog command take fixed seeds;
  every test and Editor construction gains 1u (mechanical rewrite).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-21 19:01:41 +02:00
commit cc0c164574
85 changed files with 200 additions and 160 deletions

View file

@ -17,6 +17,8 @@ using float4 = CultMath.float4;
public class ItemManager
{
// The item stream: each lot's quality and each generated fit. Seeded by whoever constructs the manager and reseeded
// by RunStart at each step of a new run, never by the clock.
public Random Random;
private Action<string> _logger;
@ -25,8 +27,10 @@ public class ItemManager
public ProvenanceLedger Lots { get; }
public GameplaySettings GameplaySettings { get; }
public ItemManager(CultCache itemData, ProvenanceLedger lots, GameplaySettings settings, Action<string> logger)
public ItemManager(uint seed, CultCache itemData, ProvenanceLedger lots, GameplaySettings settings, Action<string> logger)
{
if (seed == 0) throw new ArgumentOutOfRangeException(nameof(seed), "an item stream needs a nonzero seed");
Random = new Random(seed);
ItemData = itemData;
Lots = lots;
GameplaySettings = settings;