make armor upgrade slightly more flexible

This commit is contained in:
cora 2022-06-27 12:40:21 +02:00
parent d86be83b2b
commit 7136e54615
2 changed files with 3 additions and 3 deletions

View file

@ -115,8 +115,8 @@ function mcl_armor.register_set(def)
groups[k] = v groups[k] = v
end end
local upgrade_item = nil local upgrade_item = nil
if itemstring:find("_diamond") then if itemstring:find("_diamond") and def._mcl_upgrade_item_material then
upgrade_item = itemstring:gsub("_diamond","_netherite") upgrade_item = itemstring:gsub("_[%l%d]*$",def._mcl_upgrade_item_material)
end end
minetest.register_tool(itemstring, { minetest.register_tool(itemstring, {

View file

@ -80,7 +80,7 @@ mcl_armor.register_set({
toughness = 2, toughness = 2,
craft_material = "mcl_core:diamond", craft_material = "mcl_core:diamond",
_mcl_upgradable = true, _mcl_upgradable = true,
_mcl_upgrade_item_add = "_netherite" _mcl_upgrade_item_material = "_netherite"
}) })
mcl_armor.register_set({ mcl_armor.register_set({