From e1edcd982e7f817845040716f09961c89722fc43 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 16 Nov 2016 06:35:24 +0100 Subject: Change x_doc_items_* to _doc_items_* --- API.md | 22 +++++++++++----------- init.lua | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/API.md b/API.md index 0f6da3c..1a60f56 100644 --- a/API.md +++ b/API.md @@ -13,17 +13,17 @@ hand-written help texts for your items. The preferred way is to add the following optional fields to the item definition when using `minetest.register_node`, etc.: -* `x_doc_items_longdesc`: Long description of this item. +* `_doc_items_longdesc`: Long description of this item. Describe here what this item is, what it is for, its purpose, etc. -* `x_doc_items_usagehelp`: Description of *how* this item can be used. +* `_doc_items_usagehelp`: Description of *how* this item can be used. Only set this if needed, e.g. standard mining tools don't need this. Example: minetest.register_node("example:dice", { description = "Dice", - x_doc_items_longdesc = "A decorative dice which shows the numbers 1-6 on its sides.", - x_doc_items_usagehelp = "Rightclick the dice to roll it.", + _doc_items_longdesc = "A decorative dice which shows the numbers 1-6 on its sides.", + _doc_items_usagehelp = "Rightclick the dice to roll it.", tiles = { "example_dice.png" }, is_ground_content = false, --[[ and so on … ]] @@ -167,12 +167,12 @@ If this is not possible, use `doc.sub.items.add_hidden_item_entries`. ## New item fields 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`) -* `x_doc_items_entry_name`: The title of the entry. By default, this is the same as the `description` field +* `_doc_items_longdesc`: Long description +* `_doc_items_usagehelp`: Usage help +* `_doc_items_image`: Entry image (default: inventory image) +* `_doc_items_hidden`: Whether entry is hidden (default: `false` for Air, `true` for everything else) +* `_doc_items_create_entry`: Whether to create an entry for this item (default: `true`) +* `_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 @@ -184,7 +184,7 @@ a table where the keys are the itemstrings and the values are the the description strings for each item. Note the preferred method to set the long description is by using -the item definition field `x_doc_items_longdesc`. +the item definition field `_doc_items_longdesc`. This function is intended to be used to set the long description for items which your mods do not register by themselves. diff --git a/init.lua b/init.lua index 6f9b43f..e5a46b4 100644 --- a/init.lua +++ b/init.lua @@ -987,9 +987,9 @@ local function gather_descs() 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 + if (forced_items[id] == true or def.groups.in_doc or def._doc_items_create_entry == true) and def ~= nil then forced = true end + if def._doc_items_entry_name ~= nil then + name = def._doc_items_entry_name end if item_name_overrides[id] ~= nil then name = item_name_overrides[id] @@ -997,29 +997,29 @@ local function gather_descs() if name == nil then name = def.description end - 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 + if not (((def.description == nil or def.description == "") and def._doc_items_entry_name == nil) or def.groups.not_in_doc or forced_items[id] == false or def._doc_items_create_entry == false) or forced then + if def._doc_items_longdesc then + ld = def._doc_items_longdesc end if help.longdesc[id] ~= nil then ld = help.longdesc[id] end - if def.x_doc_items_usagehelp then - uh = def.x_doc_items_usagehelp + if def._doc_items_usagehelp then + uh = def._doc_items_usagehelp end if help.usagehelp[id] ~= nil then uh = help.usagehelp[id] end - if def.x_doc_items_image then - im = def.x_doc_items_image + if def._doc_items_image then + im = def._doc_items_image end if help.image[id] ~= nil then im = help.image[id] 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 + if type(def._doc_items_hidden) == "boolean" then + hidden = def._doc_items_hidden end local custom_image name = scrub_newlines(name) -- cgit v1.2.3