local NAME = minetest.get_current_modname() local CAPACITY = 500 minetest.register_tool(NAME .. ":handdrill", { description = "Electric Handdrill", inventory_image = "electrichanddrill.png", range = 6.0, stack_max = 1, groups = { sparktech_chargable = CAPACITY }, tool_capabilities = { full_punch_interval = 0.5, max_drop_level = 3, groupcaps = { solid_stone = { --orionworld times = { [1] = 2, [2] = 1, [3] = 0.4, }, maxlevel = 3 }, cracky = { --minetest_game times = { [1] = 2.6, [2] = 1.4, [3] = 0.5 }, maxlevel = 3 }, crumbly = { --minetest_game times = { [1] = 2.00, [2] = 1.00, [3] = 0.5 }, maxlevel = 3 }, }, damage_groups = {fleshy = 1} }, after_use = function (itemstack, user, node, digparams) local meta = itemstack:get_meta() local c = meta:get_int("energy") or 0 c = c - 1 if c <= 0 then c = 0 end meta:set_int("energy", c) return itemstack:get_definition()._sparktech_update_energy(itemstack) end, _sparktech_update_energy = function (itemstack) local meta = itemstack:get_meta() local c = meta:get_int("energy") or 0 if c <= 0 then itemstack:set_wear(65535) meta:set_tool_capabilities({ full_punch_interval = 3.0, max_drop_level = 1, groupcaps = { solid_stonr = { times = { [1] = 30.0, [2] = 20.0, [3] = 10.0 }, maxlevel =1 }, cracky = { times = { [1] = 30.0, [2] = 20.0, [3] = 10.0 }, maxlevel = 1 }, crumbly = { times = { [1] = 30.0, [2] = 20.0, [3] = 10.0 }, maxlevel = 1 }, }, damage_groups = {fleshy = 1} }) return itemstack end itemstack:set_wear(65535 - math.ceil(c / CAPACITY * 65535)) meta:set_tool_capabilities(nil) return itemstack end }) minetest.register_craft({ output = NAME .. ":handdrill", recipe = { { "", "group:steel_plate", "" }, { "group:steel_plate", "default:tin_ingot", "group:steel_plate" }, { "", "default:copper_ingot", "" }, } })