From 0a9bf5502ce58982af095d6125b164c1b44bfca5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 30 Oct 2016 19:53:30 +0100 Subject: Add more item def. fields --- API.md | 3 +++ init.lua | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index 2d048c6..fe5c808 100644 --- a/API.md +++ b/API.md @@ -169,6 +169,9 @@ This mod adds support for new fields of the item definition: * `x_doc_items_longdesc`: Long description * `x_doc_items_usagehelp`: Usage help +* `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`) ## Functions This is the reference of all available functions in this API. diff --git a/init.lua b/init.lua index f85b730..b49fdac 100644 --- a/init.lua +++ b/init.lua @@ -952,19 +952,18 @@ local function gather_descs() end -- NOTE: New group “not_in_doc”: Items with this group will not have entries - -- NOTE: New group “hide_from_doc”: Items with this group will not be visible in the entry list initially local add_entries = function(deftable, category_id) 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) and def ~= nil then forced = true end + 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 item_name_overrides[id] ~= nil then name = item_name_overrides[id] else name = def.description end - if not (name == nil or name == "" or def.groups.not_in_doc or forced_items[id] == false) or forced then + 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 -- TODO: Document custom fields in API.md if def.x_doc_items_longdesc then ld = def.x_doc_items_longdesc @@ -986,6 +985,9 @@ local function gather_descs() end local hidden if id == "air" then hidden = false end + if type(def.x_doc_items_hidden) == "boolean" then + hidden = def.x_doc_items_hidden + end local custom_image name = scrub_newlines(name) local infotable = { -- cgit v1.2.3