28 lines
1.1 KiB
Lua
28 lines
1.1 KiB
Lua
-- states/ingame_targeting_melee.lua — the melee targeting prompt.
|
|||
|
|
--
|
||
|
|
-- Deliberately has NO `read`. Unlike throw targeting, melee has no cursor and no
|
||
|
|
-- target state to poll: states/ingame_targeting_melee.lua:184-195 takes a single
|
||
|
|
-- direction key, works out the tile, and fires the callback in that same
|
||
|
|
-- keypress. Nothing is ever "currently selected", so there is no focus to track
|
||
|
|
-- and the only useful moment to speak is on entry.
|
||
|
|
--
|
||
|
|
-- What we say instead is the eight adjacent tiles, which are exactly the legal
|
||
|
|
-- melee targets (the game's own rule is Chebyshev distance <= 1 --
|
||
|
|
-- models/player/playerActions.lua:3-6). Hearing them before committing is the
|
||
|
|
-- accessible equivalent of glancing at the targeting arrows.
|
||
|
|
--
|
||
|
|
-- Do not "fix" this by adding a read(): there is nothing for it to return.
|
||
|
|
|
||
|
|
local surroundings = require("accessibility.surroundings")
|
||
|
|
|
||
|
|
return {
|
||
|
|
-- A function rather than a static string: the neighbours differ every time.
|
||
|
|
onOpen = function()
|
||
|
|
local ok, text = pcall(surroundings.describeNeighbours)
|
||
|
|
if not ok then
|
||
|
|
return nil
|
||
|
|
end
|
||
|
|
return text
|
||
|
|
end,
|
||
|
|
}
|