From 97d293f8b4263dc7e11929d64d0f0aa3c1c66d44 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 17 Feb 2020 20:53:31 +0100 Subject: [PATCH] Add armor factoid --- mods/HELP/mcl_doc/init.lua | 41 ++++++++++++++++++++++++++ mods/HELP/mcl_doc/locale/mcl_doc.de.tr | 6 ++++ mods/HELP/mcl_doc/locale/template.txt | 6 ++++ 3 files changed, 53 insertions(+) diff --git a/mods/HELP/mcl_doc/init.lua b/mods/HELP/mcl_doc/init.lua index c4018f85e..e6bdae33f 100644 --- a/mods/HELP/mcl_doc/init.lua +++ b/mods/HELP/mcl_doc/init.lua @@ -128,6 +128,47 @@ doc.sub.items.register_factoid(nil, "groups", function(itemstring, def) return s end) +-- Armor +doc.sub.items.register_factoid("tools", "use", function(itemstring, def) + local def = minetest.registered_items[itemstring] + local s = "" + local head = minetest.get_item_group(itemstring, "armor_head") + local torso = minetest.get_item_group(itemstring, "armor_torso") + local legs = minetest.get_item_group(itemstring, "armor_legs") + local feet = minetest.get_item_group(itemstring, "armor_feet") + if head > 0 then + s = s .. S("It can be worn on the head.") + s = s .. "\n" + end + if torso > 0 then + s = s .. S("It can be worn on the torso.") + s = s .. "\n" + end + if legs > 0 then + s = s .. S("It can be worn on the legs.") + s = s .. "\n" + end + if feet > 0 then + s = s .. S("It can be worn on the feet.") + s = s .. "\n" + end + return s +end) +doc.sub.items.register_factoid("tools", "groups", function(itemstring, def) + local def = minetest.registered_items[itemstring] + local s = "" + local use = minetest.get_item_group(itemstring, "mcl_armor_uses") + local pts = minetest.get_item_group(itemstring, "mcl_armor_points") + if pts > 0 then + s = s .. S("Armor points: @1", pts) + s = s .. "\n" + end + if use > 0 then + s = s .. S("Armor durability: @1", use) + end + return s +end) + -- TODO: Move this info to the crafting guide doc.sub.items.register_factoid(nil, "groups", function(itemstring, def) if def._repair_material then diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.de.tr b/mods/HELP/mcl_doc/locale/mcl_doc.de.tr index dc4e85624..e929f9aec 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.de.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.de.tr @@ -71,3 +71,9 @@ Instantaneous=Unmittelbar Unlimited uses=Unbegrenzte Verwendungen Block breaking strength: @1=Blockbruchstärke: @1 Mining durability: @1=Grabehaltbarkeit: @1 +Armor points: @1=Rüstungspunkte: @1 +Armor durability: @1=Rüstungshaltbarkeit: @1 +It can be worn on the head.=Es kann auf dem Kopf getragen werden. +It can be worn on the torso.=Es kann am Torso getragen werden. +It can be worn on the legs.=Es kann an den Beinen getragen werden. +It can be worn on the feet.=Es kann an den Füßen getragen werden. diff --git a/mods/HELP/mcl_doc/locale/template.txt b/mods/HELP/mcl_doc/locale/template.txt index b622bde9f..de652f05e 100644 --- a/mods/HELP/mcl_doc/locale/template.txt +++ b/mods/HELP/mcl_doc/locale/template.txt @@ -71,3 +71,9 @@ Instantaneous= Unlimited uses= Block breaking strength: @1= Mining durability: @1= +Armor points: @1= +Armor durability: @1= +It can be worn on the head.= +It can be worn on the torso.= +It can be worn on the legs.= +It can be worn on the feet.=