Updated stone.lua
This commit is contained in:
parent
49e0f1c742
commit
e099deeaa2
@ -713,23 +713,4 @@ function on_punchnode(p, node)
|
||||
end
|
||||
minetest.register_on_punchnode(on_punchnode)
|
||||
|
||||
-- END
|
||||
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
local sides = {{x=-1,y=0,z=0}, {x=1,y=0,z=0}, {x=0,y=0,z=-1}, {x=0,y=0,z=1}, {x=0,y=-1,z=0}, {x=0,y=1,z=0},}
|
||||
for _, s in ipairs(sides) do
|
||||
if minetest.env:get_node({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z}).name == "default:stone" then
|
||||
local fall = true
|
||||
for _2, s2 in ipairs(sides) do
|
||||
if minetest.env:get_node({x=pos.x+s.x+s2.x,y=pos.y+s.y+s2.y,z=pos.z+s.z+s2.z}).name ~= "air" then
|
||||
fall = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if fall then
|
||||
minetest.env:remove_node({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z})
|
||||
minetest.env:add_item({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z}, "default:stone")
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
-- END
|
@ -150,6 +150,25 @@ function realtest.register_stone(name, StoneRef)
|
||||
instruments.chisel_pairs[name.."_slab_r"] = name.."_flat_slab_r"
|
||||
instruments.chisel_pairs[name.."_stair"] = name.."_flat_stair"
|
||||
instruments.chisel_pairs[name.."_stair_r"] = name.."_flat_stair_r"
|
||||
|
||||
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||
local sides = {{x=-1,y=0,z=0}, {x=1,y=0,z=0}, {x=0,y=0,z=-1}, {x=0,y=0,z=1}, {x=0,y=-1,z=0}, {x=0,y=1,z=0},}
|
||||
for _, s in ipairs(sides) do
|
||||
if minetest.env:get_node({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z}).name == name then
|
||||
local fall = true
|
||||
for _2, s2 in ipairs(sides) do
|
||||
if minetest.env:get_node({x=pos.x+s.x+s2.x,y=pos.y+s.y+s2.y,z=pos.z+s.z+s2.z}).name ~= "air" then
|
||||
fall = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if fall then
|
||||
minetest.env:remove_node({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z})
|
||||
minetest.env:add_item({x=pos.x+s.x,y=pos.y+s.y,z=pos.z+s.z}, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
realtest.register_stone("default:stone")
|
||||
|
Loading…
x
Reference in New Issue
Block a user