Phase 1: console history, review keys, and wall tones

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

Console (Q4: speak everything queued, cancelled by explicit action):
- history.lua keeps our own unbounded history, since the game's console buffer
  expires entries after 3s. Mirrors the game's (xN) coalescing so what is heard
  matches what is on screen. The review cursor holds position while new lines
  arrive rather than being yanked to the tail mid-read.
- patches/console.lua wraps console.print, calling the real one first so a bug
  on our side cannot swallow a message the player would otherwise see.
- Any keypress reaching the game silences the pending speech backlog.

Hotkeys: [ and ] review, Shift+[/] jump to ends, \ repeat, Shift+\ copy.
Chosen from scancodes the game does not bind. Note keybindings.getCommand()
ignores modifiers, so Ctrl+Up would read to the game as a movement -- our keys
are consumed and never overlay a game-claimed scancode.

Wall tones (Q5: on step, 3D-positioned, radius 5):
- Direction and distance are deliberately decoupled. The listener sits at the
  camera 4 units above the plane under an inverse distance model, so placing a
  tone at the wall's real position would make distant walls quieter (the
  opposite of the request) and collapse the stereo pan. Instead the source sits
  at a fixed radius in the wall's direction at listener height, and volume is
  computed explicitly from distance.
- Step detection polls player coordinates rather than hooking movement, so it
  covers walking, pathing, portals and pushes for free.
- Respects FoV/rememberedFoV; never leaks unseen geometry.

tests/test_history.lua: 16 assertions, all passing, pure Lua.

Not yet verified in actual play -- needs a human at the keyboard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Accessibility Mod
2026-08-01 20:38:28 +02:00
co-authored by Claude Opus 5
parent ff402e64c9
commit fe872be683
7 changed files with 765 additions and 4 deletions
+70 -4
View File
@@ -84,10 +84,76 @@ None block Phase 0. Q4 lands in Phase 1, Q5 + verbosity in Phase 2.
[speech]! Main menu
```
### Next — Phase 1: console history + review keys
Wrap `console.print`, keep our own unbounded history (the game's expires after 3s),
mirror its `(x3)` coalescing, add review keys. Needs Q4 answered (auto-speak policy)
but a sensible default can ship first.
### Done — Phase 1: console history + review keys · + wall tones
- `accessibility/history.lua` — unbounded (1000-entry ring) history. Mirrors the
game's `(xN)` coalescing so speech matches the screen. Review cursor **holds
still while new lines arrive** and only follows the tail when not being used.
- `accessibility/hotkeys.lua` — global key layer in front of `states.keypressed`.
- `accessibility/patches/console.lua` — wraps `console.print` (calls the real one
*first*, so a mod bug can't swallow an on-screen message) and `console.clear`.
- `accessibility/walltones.lua` — see below.
- `accessibility/tests/test_history.lua` — 16 assertions, all passing.
Run with: `lua accessibility/tests/test_history.lua` (pure Lua, no LÖVE needed).
**Auto-speak policy (Q4, answered):** speak everything, queued and joined in order
at end of frame. Any keypress that reaches the game counts as an explicit action
and silences the pending backlog (`hotkeys.onGameKey` → `speech.silence`).
**⚠ Not yet verified in-game.** Loading, the self-test, and history logic are all
confirmed. Whether console speech and wall tones behave correctly *during play*
needs a human at the keyboard — Talon to test.
### Keymap so far
| Key | Action |
|---|---|
| `[` / `]` | Previous / next console history line |
| `Shift+[` / `Shift+]` | Oldest / newest line |
| `\` | Repeat current line |
| `Shift+\` | Copy current line to clipboard |
Reserved for the tracker (Phase 3): `PageUp`/`PageDown`, `Home`, with Ctrl/Shift.
**Free scancodes** (game binds none of these): `[ ] \ ; ' , / - =`, `h k l m n o
p u v w`, `F1`–`F12`, `pageup pagedown home end insert`, `kp0 kp. kp+ kp- kp* kp/`.
**Game-claimed scancodes — never bind these unmodified:**
`. 0-9 \` a b backspace c d delete down e escape f g i j kp1-kp9 kpenter lalt
lctrl left lshift mouse3 q r ralt rctrl return right rshift s space t tab up x y z`
⚠ **`keybindings.getCommand()` dispatches on scancode alone and ignores
modifiers.** Ctrl and Shift are *held* modifiers in game (`moveCamera`,
`repeatAction`/`adjustByFive`). So `Ctrl+Up` is seen by the game as plain "up" —
a movement. Never bind a modifier combo over a game-claimed scancode. Combos over
*unclaimed* scancodes (e.g. `Ctrl+PageUp`) are safe. Always consume our keys.
### Wall tones (Q5, answered: on step, 3D-positioned, radius 5)
Key design point, in `walltones.lua`: **direction and distance are decoupled.**
The game's listener sits at the camera, 4 units above the plane, with an *inverse*
distance model. Placing a tone at its wall's real position would (a) make far
walls quieter — the opposite of what was asked — and (b) collapse the pan toward
centre, since the 4-unit vertical offset dominates a 2-unit horizontal one.
So: the source is placed at a **fixed radius** from the listener in the wall's
direction, at the listener's own height (pure horizontal pan, constant
attenuation), and **volume is computed explicitly** from distance. Positioned
relative to the listener via `love.audio.getPosition()`, so panning stays correct
even while the camera is panned away.
Step detection **polls** `playerActor.x/y` each frame instead of hooking movement
— free, and covers walking, pathing, portals and pushes by construction.
⚠ `config.louderWhenFurther = true` as requested, but this inverts the usual
convention (proximity cues normally get louder as you approach, and a near wall is
the more urgent fact). Flip the flag in `walltones.lua` if it reads backwards.
Respects `FoV`/`rememberedFoV` — never leaks unseen map geometry.
### Next — Phase 2: tile examination
Patch `views/levelCursorPopup.set` to narrate the game's existing examine mode,
augmented with distance/direction/passability. Then the surroundings explorer
(`Alt`+numpad to probe a direction without moving). Needs Q3 (verbosity) answered.
---