Add anvil-related factoids

This commit is contained in:
Wuzzy 2018-02-03 04:40:31 +01:00
parent ef471a67fa
commit dfb941cf90

View File

@ -126,6 +126,39 @@ doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
return s return s
end) end)
-- TODO: Move this info to the crafting guide
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
if def._repair_material then
local mdef = minetest.registered_items[def._repair_material]
local desc
if mdef and mdef.description and mdef.description ~= "" then
return string.format("This item can be repaired at an anvil with: %s.", mdef.description)
elseif def._repair_material == "group:wood" then
return "This item can be repaired at an anvil with any wooden planks."
elseif string.sub(def._repair_material, 1, 6) == "group:" then
local group = string.sub(def._repair_material, 7)
return string.format("This item can be repaired at an anvil with any item in the “%s” group.", group)
end
end
return ""
end)
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
if minetest.get_item_group(itemstring, "no_rename") == 1 then
return "This item cannot be renamed at an anvil."
else
return ""
end
end)
doc.sub.items.register_factoid("nodes", "gravity", function(itemstring, def)
if minetest.get_item_group(itemstring, "anvil") ~= 0 then
return "This anvil is very heavy and damages and crushes (nearly) everything under its weight."
else
return ""
end
end)
-- Mining, hardness and all that -- Mining, hardness and all that
doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def) doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
local pickaxey = { "Diamond Pickaxe", "Iron Pickaxe", "Stone Pickaxe", "Golden Pickaxe", "Wooden Pickaxe" } local pickaxey = { "Diamond Pickaxe", "Iron Pickaxe", "Stone Pickaxe", "Golden Pickaxe", "Wooden Pickaxe" }
@ -189,6 +222,7 @@ doc.sub.items.register_factoid("nodes", "mining", function(itemstring, def)
if not blast then if not blast then
blast = 0 blast = 0
end end
-- TODO: Blast resistance as number
if blast >= 1000 then if blast >= 1000 then
datastring = datastring .. "\n" .. "This block will not be destroyed by TNT explosions." datastring = datastring .. "\n" .. "This block will not be destroyed by TNT explosions."
end end
@ -224,5 +258,3 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
end) end)
-- TODO: Blast resistance (omitted for now because explosions ignore hardness)