-- =================================================================== local nodes_of_interest = { "default:lava_flowing" , "default:lava_source" , "default:water_flowing" , "default:water_source" , "codersea:water_flowing" , "codersea:water_source" , } local interest_set = ocutil.make_set (nodes_of_interest) -- =================================================================== local function is_node_of_interest (uppos) local upname = minetest.get_node (uppos).name if interest_set [upname] ~= nil then return true end return false end -- =================================================================== local function is_air (uppos) local upname = minetest.get_node (uppos).name if (upname == "air") then return true end return false end -- =================================================================== minetest.register_abm ({ catch_up = false , chance = 1 , interval = 1 , nodenames = nodes_of_interest , neighbors = { "air" } , action = function (pos, node) if pos.y > 0 then return end local uppos local newnode = "default:flooddiv" local uppos = { x = pos.x, y = pos.y-1, z = pos.z } if is_air (uppos) then minetest.add_node (pos, { name = newnode }) return end for xi = -1,1 do for zi = -1,1 do uppos = { x = pos.x+xi, y = pos.y, z = pos.z+zi } if is_air (uppos) then minetest.add_node (pos, { name = newnode }) return end end end end }) minetest.register_alias ("default:waterdiv" , "default:flooddiv")