Commit Graph
1 Commits
Author SHA1 Message Date
Accessibility ModandClaude Opus 5 55b19dd537 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>
2026-08-03 02:19:51 +02:00