Falling stones

A stone falls if there are no nodes around. Cobble replaced by stone in anvil recipe.
This commit is contained in:
Kotolegokot 2012-10-13 16:38:36 +06:00
parent 5ccaf4eb6e
commit 6eb38bce42
2 changed files with 22 additions and 3 deletions

View File

@ -35,9 +35,9 @@ end
minetest.register_craft({ minetest.register_craft({
output = 'anvil:self', output = 'anvil:self',
recipe = { recipe = {
{'default:cobble','default:cobble','default:cobble'}, {'default:stone','default:stone','default:stone'},
{'','default:cobble',''}, {'','default:stone',''},
{'default:cobble','default:cobble','default:cobble'}, {'default:stone','default:stone','default:stone'},
} }
}) })

View File

@ -1283,3 +1283,22 @@ end
minetest.register_on_punchnode(on_punchnode) minetest.register_on_punchnode(on_punchnode)
-- END -- 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)