Phase 4: menu descriptors for 16 states
Game-file footprint unchanged: still one line in main.lua. Adds descriptors for actions_menu, worldmap, alchemy_table, journal, character, inventory, and a shared one for the full-screen prose states (menu_text, ingame_message, menu_message). The prose states also push their text into the console history, so the existing review keys walk the manual paragraph by paragraph rather than delivering it as one unusable utterance. Two driver improvements, both prompted by real failures the self-test caught: - menus.getAnyUpvalue finds a file-local across all of a state's functions and one level into inner closures. Safe because a Lua file-local is a single shared upvalue. Needed because actions_menu and worldmap build their lists in open() and never reference them in keypressed, so the named probe function found nothing. The generic probe path now falls back to this. - menus.hasUpvalue checks that a local exists rather than that it holds a value. getUpvalue cannot distinguish 'no such local' from 'declared but currently nil', which made the self-test report PROBE BROKEN for worldmap, whose 'local options' is nil until the screen is first opened. patches/popups.lua now stands down for any state that has a descriptor. inventoryCursorPopup.set only fires when an item is under the cursor, so empty slots and empty tabs were silent and you could not tell the cursor had moved. The inventory descriptor reports item-or-empty plus slot and tab instead. 21/21 testbed checks, history unit tests passing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
bd338087ce
commit
0477097e29
@@ -3,7 +3,7 @@
|
||||
**Read this first on any handoff.** Living document: update it whenever state changes, before ending a turn.
|
||||
|
||||
Last updated: 2026-08-01 · Currently: **Phases 0–3 done + menus/dialogue.
|
||||
Phase 4 (remaining menus) next.**
|
||||
Phase 4 mostly done. Phase 5 (status, popups) next.**
|
||||
|
||||
**Game is playable start-to-finish by ear** from main menu through the intro
|
||||
conversation into gameplay — verified by the testbed, **13/13 checks**.
|
||||
@@ -324,17 +324,52 @@ they survive. 13 kinds/32 instances → 12 kinds/19 instances.
|
||||
`chest_tutorial` literally prints "find nothing of use for now" — it has no loot
|
||||
yet. Verify against a later area before trusting those two categories.)*
|
||||
|
||||
### Done — Phase 4 (most of it): menu descriptors
|
||||
|
||||
**16 states now have descriptors** — all registered in `describedStates` in
|
||||
`init.lua`, all resolving in the startup self-test:
|
||||
|
||||
`main_menu` · `settings_menu` · `load_game` · `new_game` · `narration` ·
|
||||
`ingame_dialogue` · `ingame_observe` · `actions_menu` · `worldmap` ·
|
||||
`alchemy_table` · `journal` · `character` · `inventory` ·
|
||||
`menu_text` / `ingame_message` / `menu_message` (shared `_textscreen.lua`)
|
||||
|
||||
Verified live: `Journal. Quests, A simple commission, 1 of 1` ·
|
||||
`Character, 1 of 3` · `Actions. Interact, 1 of 1` ·
|
||||
`Inventory. All items, empty, slot 1`. **21/21 testbed checks.**
|
||||
|
||||
#### Two driver improvements (both prompted by real failures)
|
||||
|
||||
- **`menus.getAnyUpvalue`** — finds a file-local across *all* of a state's
|
||||
functions plus one level into inner closures. Safe because a Lua file-local is
|
||||
a single shared upvalue, so any closure referencing it sees the same variable.
|
||||
Needed because `actions_menu` and `worldmap` build their lists in `open()` and
|
||||
never mention them in `keypressed`. The generic probe path now falls back to it.
|
||||
- **`menus.hasUpvalue`** — checks a local *exists* rather than *holds a value*.
|
||||
`getUpvalue` can't tell "no such local" from "declared but nil", which made the
|
||||
self-test cry PROBE BROKEN on `worldmap` (whose `local options` is nil until
|
||||
the screen opens). Self-test now reports `ok (unset until opened)`.
|
||||
|
||||
#### Ownership rule: descriptors beat the popup patch
|
||||
`patches/popups.lua` now **stands down for any state that has a descriptor.**
|
||||
`inventoryCursorPopup.set` only fires when there *is* an item, so on an empty
|
||||
slot or empty tab it said nothing — you couldn't tell whether the cursor moved.
|
||||
The `inventory` descriptor reports item-or-empty plus slot and tab; letting both
|
||||
speak would double up on every item.
|
||||
|
||||
### Known gaps (next up)
|
||||
- **Phase 4**: descriptors for `worldmap`, `journal`, `character`, `research`,
|
||||
`inventory`, `craft`, `refine`, `trade`, `actions_menu`, `alchemy_table`,
|
||||
`keybindings_menu`, `config_menu`, `menu_text`, `ingame_message`,
|
||||
`menu_message`. (`inventory`/`craft`/`refine`/`trade` are partly covered
|
||||
already by the `inventoryCursorPopup` patch.)
|
||||
- **Phase 4 remainder**: `research`, `config_menu`, `keybindings_menu` have no
|
||||
descriptors. `craft` / `refine` / `trade` are covered only by the
|
||||
`inventoryCursorPopup` patch — so, like inventory was, they will be silent on
|
||||
empty slots and say nothing about the quantity **slider** in the confirmation
|
||||
window (`modules/slider.lua`, Left/Right adjusts, Shift for ×5).
|
||||
- **Phase 5**: player status key (HP, statuses, current action), popup
|
||||
announcements, damage alerts, mod settings.
|
||||
announcements (`popupStack.add`), damage alerts
|
||||
(`ingame.checkInterruptions`), mod settings.
|
||||
- `ingame` itself has no descriptor.
|
||||
- Tracker categories Items/Alchemy/Exits/Creatures/Terrain unverified against a
|
||||
populated area — the tutorial house has none of them.
|
||||
- **Unverified against real content:** tracker categories Items / Alchemy /
|
||||
Exits / Creatures / Terrain (tutorial house has none), and inventory item
|
||||
names (inventory is empty in the prologue).
|
||||
- `worldmap`, `journal`, `character`, `research`, `inventory`, `craft`, `refine`,
|
||||
`trade`, `actions_menu`, `alchemy_table`, `keybindings_menu`, `config_menu`,
|
||||
`menu_text`, `ingame_message`, `menu_message` still have no descriptors.
|
||||
|
||||
Reference in New Issue
Block a user