add toolranks to enchanted tools if the mod is enabled

This commit is contained in:
Somedumbguy 2024-05-29 12:09:46 -04:00
parent d88cfbf9d8
commit b8222cdebe
2 changed files with 6 additions and 2 deletions

View File

@ -2,5 +2,5 @@ name = xdecor
title = X-Decor-libre title = X-Decor-libre
description = A decoration mod meant to be simple and well-featured (libre version). description = A decoration mod meant to be simple and well-featured (libre version).
depends = default, bucket, doors, farming, stairs, xpanes depends = default, bucket, doors, farming, stairs, xpanes
optional_depends = playerphysics, player_api, fire, moreblocks, mesecons, unified_inventory, tt optional_depends = playerphysics, player_api, fire, moreblocks, mesecons, unified_inventory, tt, toolranks
min_minetest_version = 5.7.0 min_minetest_version = 5.7.0

View File

@ -309,7 +309,8 @@ function enchanting:register_tools(mod, def)
local arg1 = def.material_desc[material] or cap(material) local arg1 = def.material_desc[material] or cap(material)
local arg2 = def.tools[tool].desc or cap(tool) local arg2 = def.tools[tool].desc or cap(tool)
local arg3 = self:get_tooltip(enchant, original_groupcaps[group], fleshy) local arg3 = self:get_tooltip(enchant, original_groupcaps[group], fleshy)
minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { local enchantedTool = mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant
minetest.register_tool(":" .. enchantedTool, {
description = S("Enchanted @1 @2\n@3", arg1, arg2, arg3), description = S("Enchanted @1 @2\n@3", arg1, arg2, arg3),
short_description = S("Enchanted @1 @2", arg1, arg2), short_description = S("Enchanted @1 @2", arg1, arg2),
inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", inventory_image = original_tool.inventory_image .. "^[colorize:violet:50",
@ -321,6 +322,9 @@ function enchanting:register_tools(mod, def)
max_drop_level = max_drop_level max_drop_level = max_drop_level
} }
}) })
if minetest.get_modpath("toolranks") then
toolranks.add_tool(enchantedTool)
end
end end
end end
end end