Make still water detach dug_by_water nodes as well

This commit is contained in:
Wuzzy 2017-05-09 19:53:07 +02:00
parent 9cc3e091ca
commit bb965b6d63
1 changed files with 5 additions and 4 deletions

View File

@ -90,7 +90,8 @@ local function drop_attached_node(p)
end end
end end
-- Remove attached nodes next to flowing water -- Remove attached nodes next to and below water.
-- TODO: This is just an approximation! Attached nodes should be removed if water wants to flow INTO that space.
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:dig_by_water"}, nodenames = {"group:dig_by_water"},
neighbors = {"group:water"}, neighbors = {"group:water"},
@ -102,18 +103,18 @@ minetest.register_abm({
local p = {x=pos.x+xp, y=pos.y, z=pos.z+zp} local p = {x=pos.x+xp, y=pos.y, z=pos.z+zp}
local n = minetest.get_node(p) local n = minetest.get_node(p)
local d = minetest.registered_nodes[n.name] local d = minetest.registered_nodes[n.name]
if (d.groups.water and d.liquidtype == "flowing") then if (d.groups.water) then
drop_attached_node(pos) drop_attached_node(pos)
minetest.dig_node(pos) minetest.dig_node(pos)
break break
end end
end end
end end
for yp=-1,1 do for yp=-1,0 do
local p = {x=pos.x, y=pos.y+yp, z=pos.z} local p = {x=pos.x, y=pos.y+yp, z=pos.z}
local n = minetest.get_node(p) local n = minetest.get_node(p)
local d = minetest.registered_nodes[n.name] local d = minetest.registered_nodes[n.name]
if (d.groups.water and d.liquidtype == "flowing") then if (d.groups.water) then
drop_attached_node(pos) drop_attached_node(pos)
minetest.dig_node(pos) minetest.dig_node(pos)
break break