Skip to content

A town simulation in pale isometric line art, implemented with Ritmo ECS and PixiJs 3D

check:browser: a save from before Ritmo 0.23 loads with no next states queued

SandroMaglione45e8bbe83de6
diff --git a/scripts/check-browser.ts b/scripts/check-browser.ts
index e0a97c2..d5578ac 100644
--- a/scripts/check-browser.ts
+++ b/scripts/check-browser.ts
@@ -126,7 +126,8 @@ try {
await page.getByRole("button",{name:"Load without saving",exact:true}).click()
await page.waitForFunction(()=>window.town.shown.town.stats!.settlers>100)
// The guide puts away what the bot's town has already done (as edits, kept on the next frame without a step of time); the rest loads exactly as saved.
- const withoutGuide=(w:Snapshot)=>({...w,resources:{...w.resources,"Town/Guide":null}})
+ // A save written before Ritmo 0.23 has no `nextStates`; it loads with none queued.
+ const withoutGuide=(w:Snapshot)=>({...w,nextStates:w.nextStates??{},resources:{...w.resources,"Town/Guide":null}})
await page.waitForFunction(()=>window.town.snapshot().resources["Town/Guide"].done.length>0)
const loaded=await snapshot()
assert.deepEqual(withoutGuide(loaded),withoutGuide(grown.world))
diff --git a/src/game/headless.ts b/src/game/headless.ts
index 1ceeb1d..ac4d272 100644
--- a/src/game/headless.ts
+++ b/src/game/headless.ts
@@ -22,6 +22,8 @@ export interface Snapshot {
relations: Record<string, Array<[number, Array<number>]>>
resources: Record<string, any>
machines: Record<string, unknown>
+ /** The next states queued for the next marker, by machine (Ritmo 0.23 saves them; a save from before has none). */
+ nextStates?: Record<string, unknown>
}
/** The edit queue of a town about to be founded: one edit founds it on the first step. */