From 259ad89ded35c4b56c4f47c1686abeec191767a9 Mon Sep 17 00:00:00 2001 From: 44r0n7 <44r0n7+gitea@pm.me> Date: Sat, 24 Oct 2026 01:04:25 -0400 Subject: [PATCH] Loading a world clears cards left from the last one (t11) Co-Authored-By: Claude Opus 5.5 --- docs/PROJECT_MAP.md | 2 +- docs/agent-log.md | 10 ++++++++++ src/ui/session.js | 3 +++ tasks/t11_welcome_first_milestone.md | 10 ++++++++-- test/play.py | 2 ++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/PROJECT_MAP.md b/docs/PROJECT_MAP.md index da5ef48..09fef4c 100644 --- a/docs/PROJECT_MAP.md +++ b/docs/PROJECT_MAP.md @@ -374,7 +374,7 @@ Saves in IndexedDB, world files (export / import) and the blueprint library. - functions: newWorldId, worldWrite, listWorlds, putWorldEntry, worldNewest, deleteWorld, renameWorld, migrateWorlds, saveWorld, newestSave, b64FromBytes, bytesFromB64, gz, exportWorld, importWorldFile, libLoad, libSave, bpEncode, bpValid, bpDecode - variables: DB, worldIdTime, worldIdCounter, worldWrites -### src/ui/session.js (122 lines) +### src/ui/session.js (125 lines) Starting, loading and quitting a game; modal dialogs; the pause menu. - functions: showLoading, enterGame, startNewWorld, startFromSave, quitToTitle, refreshContinue, anyModal, openModal, closeModal, closeAllModals, topModal, dialog, openPause, renderWorlds diff --git a/docs/agent-log.md b/docs/agent-log.md index a90755d..a002796 100644 --- a/docs/agent-log.md +++ b/docs/agent-log.md @@ -4,6 +4,16 @@ What agents have done, newest first. Add an entry for every piece of work: the d note or request it was for, what changed, the files touched, the tests run, and anything left open or not verified. Keep each entry short; the git history has the details. +## 2026-10-24: t11 Welcome and first milestone shown again on an older world (Claude Code, Codex) + +- Cause: nothing cleared the discovery cards (`#cards`) when a world was entered, so a new + world's Welcome and milestone cards stayed up after loading an older world. +- `src/ui/session.js`: `enterGame` clears the cards, floaters, particles and the status line; + a new world still shows its Welcome card afterwards. +- `test/play.py`: a new world shows Welcome; loading a world from the list shows no cards. +- Tests: `run_all.py --browser` passes (153 `play.py` checks). `t_smooth`'s half-resolution + check flaked (passed and failed on reruns, with and without this change; the machine was busy). + ## 2026-10-24: the to-do list moved from NOTES.md to a kandown board (Claude Code) Request: initialize kandown (https://kandown.dev, 0.52.0) for the project, move all the notes diff --git a/src/ui/session.js b/src/ui/session.js index 5d164d1..9bb585f 100644 --- a/src/ui/session.js +++ b/src/ui/session.js @@ -5,6 +5,9 @@ function showLoading(on, p) { if (on) { $('loadbar').style.width = Math.round((p || 0) * 100) + '%'; $('loadtext').textContent = Math.round((p || 0) * 100) + '%'; } } function enterGame() { + $('cards').innerHTML = ''; + if (R.floaters) R.floaters.length = 0; R.particles.length = 0; + GAME.status = ''; GAME.statusT = 0; $('title').hidden = true; $('hud').hidden = false; GAME.running = true; GAME.paused = false; buildSky(); resizeRender(); snapCamera(); diff --git a/tasks/t11_welcome_first_milestone.md b/tasks/t11_welcome_first_milestone.md index cbdc68a..3dfa63e 100644 --- a/tasks/t11_welcome_first_milestone.md +++ b/tasks/t11_welcome_first_milestone.md @@ -1,10 +1,16 @@ --- id: t11 title: Welcome and first milestone shown again on an older world -status: Todo +status: Review created: 2026-10-24 -updated: 2026-10-24T04:41:46Z +updated: 2026-10-24T05:04:13Z tags: [bug] +order: 5 +report: | + (agent) Fixed: loading a world now clears the cards in the lower right, so cards from the + world you were just in (Welcome, first milestone) no longer carry over. + To check: make a new world, quit to the title, load an older world from Worlds. No Welcome + or milestone card should show. A brand-new world still shows its Welcome card. --- ## Context diff --git a/test/play.py b/test/play.py index 2d4b9c2..b5075ac 100644 --- a/test/play.py +++ b/test/play.py @@ -45,6 +45,7 @@ with sync_playwright() as p: if not pg.is_visible('#nw-seed'): pg.click('#btn-new') pg.fill('#nw-seed', str(seed)); pg.click('#btn-generate') pg.wait_for_function('GAME.running', timeout=20000) + check(f'new world {seed} shows the Welcome card', pg.evaluate("[...$('cards').children].some(c => c.textContent.includes('Welcome'))")) pg.evaluate('quitToTitle()') pg.wait_for_function("!$('title').hidden") pg.click('#btn-worlds'); pg.locator('#m-worlds').wait_for(state='visible') @@ -61,6 +62,7 @@ with sync_playwright() as p: row = pg.locator(f'[data-world="{ids[str(seed)]}"]') row.get_by_role('button', name='Load', exact=True).click(); pg.wait_for_function('GAME.running') check(f'Load switches to seed {seed}', pg.evaluate('worldSeed') == seed and pg.evaluate('GAME.worldId') == ids[str(seed)]) + check(f'loading seed {seed} shows no cards left from another world', pg.evaluate("$('cards').children.length") == 0) pg.evaluate('quitToTitle()'); pg.click('#btn-worlds') row = pg.locator(f'[data-world="{ids["222"]}"]') row.get_by_role('button', name='Rename', exact=True).click()