hotbar: say what the key you pressed just did
Pressing a hotbar key ran hotkey.action(state), which for an equipment binding calls an itemActions entry's onActivation directly -- Wield, Drink, Switch on, Pack away. None of those reach console.print or a popup; most only play a sound. So the whole hotbar was silent: no item name, no verb, no confirmation the key had registered at all. patches/hotbar.lua wraps the hotbar VIEW factory, not models/hotkey: models/hotbar.lua captures newHotkey as a file-local at require time, and models/world.lua captures newHotbar the same way, both long before our entry point. views/hotbar.lua is required only by the three states, which load lazily -- the same ordering argument as patches/slider.lua. The verb is computed BEFORE the action runs. The itemAction conditions key off item.isEquipped, which the action itself flips, so asked afterwards they return the opposite verb and a press that wielded would announce "Unwield". Also narrates the empty slot, the silent no-applicable-action branch, binding and unbinding (sound-only in game), and action-type slots. Says nothing when the item is missing from the inventory -- the game prints that itself and patches/console.lua speaks it. 78 testbed checks, 0 failures. The prologue gives the player no items, so the live path is exercised by planting a torch, binding it to slot 1, pressing 1 twice and putting the world back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1f48dea550
commit
55b19dd537
@@ -251,6 +251,7 @@ function accessibility.initialize()
|
||||
accessibility.registerPatch("slider", require("accessibility.patches.slider"))
|
||||
accessibility.registerPatch("popupstack", require("accessibility.patches.popupstack"))
|
||||
accessibility.registerPatch("itemmenu", require("accessibility.patches.itemmenu"))
|
||||
accessibility.registerPatch("hotbar", require("accessibility.patches.hotbar").apply)
|
||||
|
||||
pcall(function()
|
||||
require("accessibility.surroundings").registerKeys(hotkeys)
|
||||
|
||||
Reference in New Issue
Block a user