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:
co-authored by
Claude Opus 5
parent
ff402e64c9
commit
fe872be683
@@ -15,6 +15,8 @@ local accessibility = {}
|
||||
|
||||
local speech = require("accessibility.speech")
|
||||
local stateNames = require("accessibility.stateNames")
|
||||
local hotkeys = require("accessibility.hotkeys")
|
||||
local walltones = require("accessibility.walltones")
|
||||
|
||||
local initialized = false
|
||||
|
||||
@@ -86,9 +88,28 @@ local function hookStates()
|
||||
local realUpdate = states.update
|
||||
states.update = function(dt)
|
||||
local result = realUpdate(dt)
|
||||
pcall(walltones.update)
|
||||
pcall(speech.flush)
|
||||
return result
|
||||
end
|
||||
|
||||
-- Global hotkey layer. Ours are consumed; everything else falls through to the
|
||||
-- game untouched.
|
||||
local realKeypressed = states.keypressed
|
||||
states.keypressed = function(key, scancode)
|
||||
local consumed = false
|
||||
local ok, result = pcall(hotkeys.keypressed, key, scancode)
|
||||
if ok then
|
||||
consumed = result
|
||||
end
|
||||
|
||||
if consumed then
|
||||
return
|
||||
end
|
||||
|
||||
pcall(hotkeys.onGameKey)
|
||||
return realKeypressed(key, scancode)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -101,8 +122,11 @@ function accessibility.initialize()
|
||||
end
|
||||
initialized = true
|
||||
|
||||
accessibility.registerPatch("console", require("accessibility.patches.console"))
|
||||
|
||||
local ok, err = pcall(function()
|
||||
speech.initialize()
|
||||
walltones.load()
|
||||
hookStates()
|
||||
applyPatches()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user