Add armor factoid

This commit is contained in:
Wuzzy 2020-02-17 20:53:31 +01:00
parent 33acd2327f
commit 97d293f8b4
3 changed files with 53 additions and 0 deletions

View File

@ -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

View File

@ -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.

View File

@ -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.=