Avoid unnecessary registration

This commit is contained in:
AFCMS 2021-03-29 21:39:04 +02:00
parent 9990db92b4
commit 31027aca2e
1 changed files with 68 additions and 64 deletions

View File

@ -186,6 +186,9 @@ for _,first_color in ipairs(colors) do
})
itemcount = itemcount + 4
for _,second_color in ipairs(colors) do
if minetest.registered_tools["mcl_armor:helmet_leather_"..second_color[1].."_"..first_color[1]] then
minetest.register_alias("mcl_armor:helmet_leather_"..first_color[1].."_"..second_color[1], "mcl_armor:helmet_leather_"..second_color[1].."_"..first_color[1]) --Avoid unnecessary registration
else
minetest.register_tool("mcl_armor:helmet_leather_"..first_color[1].."_"..second_color[1], {
description = S("Leather Cap "..first_color[2].." "..second_color[2]),
_doc_items_longdesc = longdesc,
@ -246,6 +249,8 @@ for _,first_color in ipairs(colors) do
on_place = get_on_armor_leather_use(itemname, "mcl_armor:boots_leather"),
on_secondary_use = get_on_armor_leather_use(itemname, "mcl_armor:boots_leather"),
})
itemcount = itemcount + 4
end
minetest.register_craft({
type = "shapeless",
output = "mcl_armor:helmet_leather_"..first_color[1].."_"..second_color[1],
@ -266,12 +271,11 @@ for _,first_color in ipairs(colors) do
output = "mcl_armor:boots_leather_"..first_color[1].."_"..second_color[1],
recipe = {"mcl_armor:boots_leather_"..first_color[1], second_color[3]},
})
itemcount = itemcount + 4
end
end
--minetest.register_on_joinplayer(function()
-- minetest.chat_send_all(itemcount)
--end)
minetest.register_on_joinplayer(function()
minetest.chat_send_all(itemcount)
end)
minetest.log("info", "[mcl_armor] "..itemcount.." leather armor pieces have been registered")