From dfe653e1789538f9b669db2dcb788c71447cc7c9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 13 Dec 2016 12:31:26 +0100 Subject: *_durability and make it more flexible --- API.md | 4 +++- init.lua | 7 +++++-- locale/de.txt | 3 ++- locale/template.txt | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/API.md b/API.md index 3103992..b7cd14f 100644 --- a/API.md +++ b/API.md @@ -46,7 +46,9 @@ 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 +* `_doc_items_durability`: Two meanings: + * It it is a `number`: Number of uses for a tool before it breaks, use this is the use count is fixed. + * If it is a `string`: Free-form text which explains how the durability works. Try to keep it short. A full explanation of these fields is provided below. diff --git a/init.lua b/init.lua index d9fc140..4edab4d 100644 --- a/init.lua +++ b/init.lua @@ -832,8 +832,11 @@ doc.new_category("tools", { 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) + if type(data.def._doc_items_durability) == "number" then + datastring = datastring .. S("Durability: @1 uses", data.def._doc_items_durability) + datastring = newline(datastring) + elseif type(data.def._doc_items_durability) == "string" then + datastring = datastring .. S("Durability: @1", data.def._doc_items_durability) datastring = newline(datastring) end diff --git a/locale/de.txt b/locale/de.txt index ea95ad5..5289a29 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -131,4 +131,5 @@ Unknown item (@1) = Unbekannter Gegenstand (@1) • Renewable = • Erneuerbar • Viscosity: @1 = • Zähflüssigkeit: @1 Itemstring: "@1" = Itemstring: »@1« -Uses: @1 = Benutzungen: @1 +Durability: @1 uses = Haltbarkeit: @1 Benutzungen +Durability: @1 = Haltbarkeit: @1 diff --git a/locale/template.txt b/locale/template.txt index 566af57..fbe5bde 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -132,4 +132,5 @@ Unknown item (@1) = • Renewable = • Viscosity: @1 = Itemstring: "@1" = -Uses: @1 = +Durability: @1 uses = +Durability: @1 = -- cgit v1.2.3