From 4ae274b9e282cbd3de4b6d8779a2245cb12a1f0e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 13 Dec 2016 02:13:36 +0100 Subject: Add support to specify tool uses --- API.md | 1 + init.lua | 12 +++++++++--- locale/de.txt | 1 + locale/template.txt | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index fb2d839..3103992 100644 --- a/API.md +++ b/API.md @@ -46,6 +46,7 @@ easy and quick manipulation of the item help entries. All fields are optional. * `_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. This field is required if the `description` is empty +* `_doc_items_uses_fixed`: Exact number of uses for a tool before it breaks, use this is the use count is fixed. If it varies or is unlimited, please don't use this field A full explanation of these fields is provided below. diff --git a/init.lua b/init.lua index b3fc35f..d9fc140 100644 --- a/init.lua +++ b/init.lua @@ -822,14 +822,20 @@ doc.new_category("tools", { datastring = datastring .. S("Usage help: @1", usagehelp) datastring = newline2(datastring) end + datastring = datastring .. get_custom_factoids("tools", "use", data) datastring = newline2(datastring) if data.itemstring ~= "" then - datastring = datastring .. S("Maximum stack size: @1", data.def.stack_max).. "\n" + datastring = datastring .. S("Maximum stack size: @1", data.def.stack_max) + datastring = newline(datastring) + end + datastring = datastring .. range_factoid(data.itemstring, data.def) + datastring = newline(datastring) + if data.def._doc_items_uses ~= nil then + datastring = datastring .. S("Uses: @1", data.def._doc_items_uses) + datastring = newline(datastring) end - - datastring = datastring .. range_factoid(data.itemstring, data.def) .. "\n" datastring = newline2(datastring) diff --git a/locale/de.txt b/locale/de.txt index bbf29f8..ea95ad5 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -131,3 +131,4 @@ Unknown item (@1) = Unbekannter Gegenstand (@1) • Renewable = • Erneuerbar • Viscosity: @1 = • Zähflüssigkeit: @1 Itemstring: "@1" = Itemstring: »@1« +Uses: @1 = Benutzungen: @1 diff --git a/locale/template.txt b/locale/template.txt index a44e6d7..566af57 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -132,3 +132,4 @@ Unknown item (@1) = • Renewable = • Viscosity: @1 = Itemstring: "@1" = +Uses: @1 = -- cgit v1.2.3