Files

38 lines
1.0 KiB
Lua
Raw Permalink Normal View History

2026-08-01 22:00:52 +02:00
-- states/alchemy_table.lua — sort / grind / distill.
--
-- The options carry no title, only a `description` and a `refinementType`. The
-- refinement type is the actual name of the operation, so lead with that and let
-- the description follow.
--
-- Distillation is gated behind a story flag, and open() recomputes `enabled`
-- every time -- announcing unavailability matters, since otherwise selecting it
-- appears to do nothing.
return {
probe = {
fn = "keypressed",
focus = "selectedOption",
list = "craftingOptions",
},
render = function(entry, index, total)
local name = entry.refinementType or "?"
name = name:sub(1, 1):upper() .. name:sub(2)
local parts = {name}
if entry.enabled == false then
parts[#parts + 1] = "unavailable"
if entry.disabledDescription then
parts[#parts + 1] = entry.disabledDescription
end
elseif entry.description then
parts[#parts + 1] = entry.description
end
parts[#parts + 1] = index .. " of " .. total
return table.concat(parts, ", ")
end,
}