- --- Pickaxes ---
-
- minetest.register_tool("xdecor:enchanted_pick_"..m.."_durable", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Pickaxe (Durable)",
- inventory_image = minetest.registered_tools["default:pick_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- cracky = {times=times, uses=use_longer, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
-
- minetest.register_tool("xdecor:enchanted_pick_"..m.."_fast", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Pickaxe (Fast)",
- inventory_image = minetest.registered_tools["default:pick_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- cracky = {times=dig_faster, uses=uses, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
-
- --- Axes ---
-
- minetest.register_tool("xdecor:enchanted_axe_"..m.."_durable", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Axe (Durable)",
- inventory_image = minetest.registered_tools["default:axe_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- choppy = {times=times, uses=use_longer, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
-
- minetest.register_tool("xdecor:enchanted_axe_"..m.."_fast", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Axe (Fast)",
- inventory_image = minetest.registered_tools["default:axe_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- choppy = {times=dig_faster, uses=uses, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
-
- --- Shovels ---
-
- minetest.register_tool("xdecor:enchanted_shovel_"..m.."_durable", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Shovel (Durable)",
- inventory_image = minetest.registered_tools["default:shovel_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- crumbly = {times=times, uses=use_longer, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
-
- minetest.register_tool("xdecor:enchanted_shovel_"..m.."_fast", {
- description = "Enchanted "..string.sub(string.upper(m), 0, 1)..string.sub(m, 2).." Shovel (Fast)",
- inventory_image = minetest.registered_tools["default:shovel_"..m]["inventory_image"],
- groups = {not_in_creative_inventory=1},
- tool_capabilities = {
- groupcaps = {
- crumbly = {times=dig_faster, uses=uses, maxlevel=maxlvl}
- },
- damage_groups = dmg
- }
- })
+ if mod == "3d_armor" then
+ local original_armor_groups = original_tool.groups
+ local armorcaps = {}
+ armorcaps.not_in_creative_inventory = 1
+
+ for armor_group, value in pairs(original_armor_groups) do
+ if enchant == "strong" then
+ armorcaps[armor_group] = math.ceil(value * enchanting.strength)
+ elseif enchant == "speed" then
+ armorcaps[armor_group] = value
+ armorcaps.physics_speed = enchanting.speed
+ armorcaps.physics_jump = enchanting.jump
+ end
+ end
+
+ minetest.register_tool(":"..mod..":enchanted_"..tool.."_"..material.."_"..enchant, {
+ description = "Enchanted "..cap(material).." "..cap(tool).." ("..cap(enchant)..")",
+ inventory_image = original_tool.inventory_image,
+ texture = "3d_armor_"..tool.."_"..material,
+ wield_image = original_tool.wield_image,
+ groups = armorcaps,
+ wear = 0
+ })
+ end
+ end
+end