Added (chain) for [CHAIN_METAL_TEXT] armours in library/gui/materials.lua used by the gui/create-item script (#2037)

develop
Tachytaenius 2022-03-19 22:32:16 +00:00 committed by GitHub
parent e1961f5fcd
commit 19c0a4fe06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

@ -49,6 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `EventManager`: now each registered handler for an event can have its own frequency instead of all handlers using the lowest frequency of all handlers
- `stocks`: allow search terms to match the full item label, even when the label is truncated for length
- `dfhack-examples-guide`: add mugs to ``basic`` manager orders
- `gui/create-item`: Added "(chain)" annotation text for armours with the [CHAIN_METAL_TEXT] flag set
## Documentation
- Add more examples to the plugin skeleton files so they are more informative for a newbie

@ -314,12 +314,13 @@ function ItemTypeDialog(args)
if defcnt > 0 then
for subtype = 0,defcnt-1 do
local def = dfhack.items.getSubtypeDef(itype, subtype)
local text
local success, chain = pcall(function() return def.props.flags.CHAIN_METAL_TEXT end)
local text = success and chain and " (chain) " or " "
local success, adjective = pcall(function() return def.adjective end)
if success and adjective ~= "" then
text = " " .. adjective .. " " .. def.name
text = text .. adjective .. " " .. def.name
else
text = " " .. def.name
text = text .. def.name
end
if not filter or filter(itype,subtype,def) then
table.insert(choices, {