-- states/ingame_observe.lua — the examine cursor. -- -- Reads the cursor position straight off the level model rather than listening to -- levelCursorPopup.set. -- -- Why: the popup is set from an animation-completion callback (`onFinish`), so -- unless the player has turned on the game's "quickExaminationPopup" option, the -- text arrives only after the cursor finishes gliding. In testing that put each -- announcement a full keypress behind -- you would hear the previous tile while -- standing on the next one. Polling cursorX/cursorY announces on the same frame -- the cursor moves, regardless of that setting, and needs no game edit. -- -- The level model is a closure instance rather than a module, so it cannot be -- patched at require time; reading its public fields is the decoupled route. local describe = require("accessibility.describe") return { read = function() local ok, world = pcall(require, "models.world") if not ok or not world.currentLevel then return nil, nil end local level = world.currentLevel local x, y = level.cursorX, level.cursorY if type(x) ~= "number" or type(y) ~= "number" then return nil, nil end local player = level.playerActor local px = player and player.x local py = player and player.y local text = describe.tile(level, x, y, px, py) if not text or text == "" then return nil, nil end return text, x .. "," .. y end, }