Phase 2: tile examination and surroundings

Game-file footprint unchanged: still one line in main.lua.

- describe.lua: shared spatial formatting. 8-point compass and Chebyshev
  distance, since the game moves 8-directionally and Euclidean would overstate
  diagonal travel. Verbosity setting, because sweeping eight neighbours and
  inspecting a single tile want different amounts of detail.
- states/ingame_observe.lua: narrates the game's existing examine cursor.
- surroundings.lua: probe one direction, scan all eight, or report location,
  without moving anything or touching game state.
- patches/popups.lua: wraps inventoryCursorPopup.set, covering inventory, craft,
  refine and trade in a single patch.

Q3 resolved as augment rather than relay: the game's descriptions carry no
position, which is fine on screen and useless by ear, so distance and direction
are appended.

Examine mode is polled rather than driven by levelCursorPopup. That popup is set
from an animation-completion callback, so unless the player has enabled the
game's quickExaminationPopup option the text arrives a full keypress late -- in
testing you heard the previous tile while standing on the next. Polling
level.cursorX/Y is same-frame and setting-independent.

hotkeys.isCtrlDown/isShiftDown are now overridable fields rather than direct
love.keyboard calls: real hardware state cannot be faked by love.event.push, so
without that seam every modifier-gated hotkey would be untestable.

11/11 testbed checks, history unit tests passing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Accessibility Mod
2026-08-01 21:26:35 +02:00
co-authored by Claude Opus 5
parent da512fc67e
commit 8b1eb44c38
12 changed files with 559 additions and 6 deletions
+41 -1
View File
@@ -124,6 +124,12 @@ needs a human at the keyboard — Talon to test.
| `Shift+[` / `Shift+]` | Oldest / newest line |
| `\` | Repeat current line |
| `Shift+\` | Copy current line to clipboard |
| `/` | Scan all 8 neighbours, clockwise from north (terse) |
| `;` | Where am I — level, in-game time, coordinates |
| `Ctrl`+numpad 1–9 | Probe that direction without moving (`Ctrl+kp5` = standing on) |
Game keys worth knowing: **`x`** enters examine mode (not `e`), `f` finds exits
while examining, `j` journal, `i` inventory, `c` character, `a` actions menu.
Reserved for the tracker (Phase 3): `PageUp`/`PageDown`, `Home`, with Ctrl/Shift.
@@ -239,9 +245,43 @@ where you're standing now. `playing` is cleared on level change.
*(Mono matters: OpenAL only spatialises mono sources. Stereo would not pan.)*
### Done — Phase 2: tile examination + surroundings
- `accessibility/describe.lua` — shared spatial formatting. 8-point compass,
**Chebyshev** distance (the game moves 8-directionally, so Euclidean would
overstate diagonals), and `tileFacts()` / `tile()`. Verbosity setting
(`terse`/`normal`/`verbose`) since sweeping 8 neighbours and inspecting one
tile want different amounts of detail.
- `accessibility/states/ingame_observe.lua` — narrates the game's examine cursor.
- `accessibility/surroundings.lua` — probe/scan/where-am-I without moving.
- `accessibility/patches/popups.lua` — wraps `inventoryCursorPopup.set`, covering
**inventory, craft, refine, trade** in one patch.
**Q3 answered by default: augment, not just relay.** The game's descriptions
("A wooden chair.") carry no position — fine on screen, useless by ear. We append
distance + direction, and blocked/has-items/water at normal verbosity.
#### Design note: why examine mode is polled, not popup-driven
`levelCursorPopup.set` is called from an **animation-completion callback**, so
unless the player enables the game's `quickExaminationPopup` option the text
lands a full keypress late — in testing you heard the *previous* tile while
standing on the next. The `ingame_observe` descriptor polls `level.cursorX/Y`
instead: same-frame, setting-independent, no game edit. `levelCursorPopup` is
therefore deliberately **not** patched; only `inventoryCursorPopup` is.
*(The level model is a closure instance, not a module, so it can't be patched at
require time — reading its public fields is the decoupled route.)*
#### Testability seam
`hotkeys.isCtrlDown` / `isShiftDown` are overridable fields, not direct calls to
`love.keyboard.isScancodeDown`. Real hardware state can't be faked by
`love.event.push`, so without this seam every modifier-gated hotkey would be
untestable. The testbed swaps them per keypress.
### Known gaps (next up)
- `ingame` itself has no descriptor — that's Phase 2 (tile examination).
- **Phase 3: object tracker** — the headline feature, not started.
- Wall tone retrigger fix not yet confirmed by ear.
- `ingame` itself has no descriptor (player status: HP, statuses, current action).
- `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.