-- ========================= -- DETECTAR JUEGO -- ========================= local materials if minetest.get_modpath("mcl_core") then materials = { stick = "mcl_core:stick", stone = "mcl_core:cobble", bronze = "mcl_core:iron_ingot", steel = "mcl_core:iron_ingot", diamond = "mcl_core:diamond", mese = "mcl_core:emerald", block_stone = "mcl_core:stone", block_bronze = "mcl_core:ironblock", block_steel = "mcl_core:ironblock", block_diamond = "mcl_core:diamondblock", block_mese = "mcl_core:emeraldblock", } elseif minetest.get_modpath("default") then materials = { stick = "default:stick", stone = "default:cobble", bronze = "default:bronze_ingot", steel = "default:steel_ingot", diamond = "default:diamond", mese = "default:mese_crystal", block_stone = "default:stone", block_bronze = "default:bronzeblock", block_steel = "default:steelblock", block_diamond = "default:diamondblock", block_mese = "default:mese", } end -- ========================= -- FUNCION PARA CREAR MARTILLOS -- ========================= local function register_hammer(name, desc, image, caps) minetest.register_tool("hammers_redo:" .. name, { description = desc, inventory_image = image, groups={tool=1, pickaxe=1}, tool_capabilities = caps, }) end -- ========================= -- MARTILLOS -- ========================= register_hammer("stone_hammer", "Stone Hammer", "stone_hammer.png", { full_punch_interval = 1.2, max_drop_level = 1, groupcaps = { cracky = {times = {[1]=2.5, [2]=1.6, [3]=1.2}, uses=40, maxlevel=1}, }, damage_groups = {fleshy=2}, }) register_hammer("bronze_hammer", "Bronze Hammer", "bronze_hammer.png", { full_punch_interval = 1.0, max_drop_level = 2, groupcaps = { cracky = {times = {[1]=1.8, [2]=1.2, [3]=0.9}, uses=80, maxlevel=2}, }, damage_groups = {fleshy=3}, }) register_hammer("steel_hammer", "Steel Hammer", "steel_hammer.png", { full_punch_interval = 0.9, max_drop_level = 2, groupcaps = { cracky = {times = {[1]=1.5, [2]=1.0, [3]=0.7}, uses=120, maxlevel=2}, }, damage_groups = {fleshy=4}, }) register_hammer("diamond_hammer", "Diamond Hammer", "diamond_hammer.png", { full_punch_interval = 0.7, max_drop_level = 3, groupcaps = { cracky = {times = {[1]=1.0, [2]=0.6, [3]=0.4}, uses=300, maxlevel=3}, }, damage_groups = {fleshy=6}, }) register_hammer("mese_hammer", "Mese Hammer", "mese_hammer.png", { full_punch_interval = 0.5, max_drop_level = 3, groupcaps = { cracky = {times = {[1]=0.7, [2]=0.4, [3]=0.2}, uses=500, maxlevel=3}, }, damage_groups = {fleshy=8}, }) -- ========================= -- CRAFTS -- ========================= if materials then local function craft(output, mat, block) minetest.register_craft({ output = output, recipe = { {mat, block, mat}, {"", materials.stick, ""}, {"", materials.stick, ""}, }, }) end craft("hammers_redo:stone_hammer", materials.stone, materials.block_stone) craft("hammers_redo:bronze_hammer", materials.bronze, materials.block_bronze) craft("hammers_redo:steel_hammer", materials.steel, materials.block_steel) craft("hammers_redo:diamond_hammer", materials.diamond, materials.block_diamond) craft("hammers_redo:mese_hammer", materials.mese, materials.block_mese) end -- ========================= -- SISTEMA 3x3 SEGUN MIRADA -- ========================= local hammerDigs = {} minetest.register_on_dignode(function(pos, oldnode, digger) if not digger then return end local item = digger:get_wielded_item():get_name() if not string.find(item, "hammers_redo:") then return end local name = digger:get_player_name() if name == "" or hammerDigs[name] then return end hammerDigs[name] = true local look = digger:get_look_dir() local ax = math.abs(look.x) local ay = math.abs(look.y) local az = math.abs(look.z) local function dig(p) minetest.node_dig(p, minetest.get_node(p), digger) end local p = vector.new(pos) if ay > ax and ay > az then for x = -1,1 do for z = -1,1 do if not (x == 0 and z == 0) then dig({x=p.x+x, y=p.y, z=p.z+z}) end end end elseif ax > az then for y = -1,1 do for z = -1,1 do if not (y == 0 and z == 0) then dig({x=p.x, y=p.y+y, z=p.z+z}) end end end else for x = -1,1 do for y = -1,1 do if not (x == 0 and y == 0) then dig({x=p.x+x, y=p.y+y, z=p.z}) end end end end hammerDigs[name] = nil end)