diff options
-rw-r--r-- | API.md | 2 | ||||
-rw-r--r-- | init.lua | 9 |
2 files changed, 9 insertions, 2 deletions
@@ -172,6 +172,8 @@ This mod adds support for new fields of the item definition: * `x_doc_items_image`: Entry image (default: inventory image) * `x_doc_items_hidden`: Whether entry is hidden (default: `false` for Air, `true` for everything else) * `x_doc_items_create_entry`: Whether to create an entry for this item (default: `true`) +* `x_doc_items_entry_name`: The title of the entry. By default, this is the same as the `description` field + of the item, or “Nameless entry” if it is `nil`. ## Functions This is the reference of all available functions in this API. @@ -952,16 +952,21 @@ local function gather_descs() end local add_entries = function(deftable, category_id) + -- TODO: Remove legacy support: Groups in_doc, not_in_doc; forced_items, help table, etc. for id, def in pairs(deftable) do local name, ld, uh, im local forced = false if (forced_items[id] == true or def.groups.in_doc or def.x_doc_items_create_entry == true) and def ~= nil then forced = true end + if def.x_doc_items_entry_name ~= nil then + name = def.x_doc_items_entry_name + end if item_name_overrides[id] ~= nil then name = item_name_overrides[id] - else + end + if name == nil then name = def.description end - if not (name == nil or name == "" or def.groups.not_in_doc or forced_items[id] == false or def.x_doc_items_create_entry == false) or forced then + if not (((def.description == nil or def.description == "") and def.x_doc_items_entry_name == nil) or def.groups.not_in_doc or forced_items[id] == false or def.x_doc_items_create_entry == false) or forced then if def.x_doc_items_longdesc then ld = def.x_doc_items_longdesc end |