keep _mcl_upgrade_item as nil for non diamond armor

This commit is contained in:
cora 2022-06-26 22:18:38 +02:00
parent c05e1b5f45
commit 909aa71dd3
1 changed files with 5 additions and 1 deletions

View File

@ -114,6 +114,10 @@ function mcl_armor.register_set(def)
for k, v in pairs(element_groups) do for k, v in pairs(element_groups) do
groups[k] = v groups[k] = v
end end
local upgrade_item = nil
if itemstring:find("_diamond") then
upgrade_item = itemstring:gsub("_diamond","_netherite")
end
minetest.register_tool(itemstring, { minetest.register_tool(itemstring, {
description = S(def.description .. " " .. (descriptions[name] or element.description)), description = S(def.description .. " " .. (descriptions[name] or element.description)),
@ -134,7 +138,7 @@ function mcl_armor.register_set(def)
_mcl_armor_element = name, _mcl_armor_element = name,
_mcl_armor_texture = textures[name] or modname .. "_" .. itemname .. ".png", _mcl_armor_texture = textures[name] or modname .. "_" .. itemname .. ".png",
_mcl_upgradable = def._mcl_upgradable, _mcl_upgradable = def._mcl_upgradable,
_mcl_upgrade_item = itemstring:gsub("_diamond","_netherite") _mcl_upgrade_item = upgrade_item
}) })
if def.craft_material then if def.craft_material then