summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md2
-rw-r--r--init.lua9
2 files changed, 9 insertions, 2 deletions
diff --git a/API.md b/API.md
index fe5c808..f816ad9 100644
--- a/API.md
+++ b/API.md
@@ -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.
diff --git a/init.lua b/init.lua
index 357ae86..549e2a9 100644
--- a/init.lua
+++ b/init.lua
@@ -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