From bed865dc79a63e8a75761193cf50418b6ea1a5cb Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 4 Sep 2021 03:05:56 +0200 Subject: [PATCH] refactor (WIP) --- mods/ITEMS/mcl_core/nodes_liquid.lua | 38 +++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_liquid.lua b/mods/ITEMS/mcl_core/nodes_liquid.lua index 5e50a4f7..380f12e3 100644 --- a/mods/ITEMS/mcl_core/nodes_liquid.lua +++ b/mods/ITEMS/mcl_core/nodes_liquid.lua @@ -167,13 +167,37 @@ minetest.register_abm({ interval = 1, chance = 1, action = function(pos, node) - local below_pos = {x=pos.x, y=pos.y-1, z=pos.z} - local below_node = minetest.get_node(below_pos) - flow_water_downwards( - below_pos, - below_node, - 20 - ) + local neighbours_pos + for i=1,80 do + local below_pos = {x=pos.x, y=pos.y-i, z=pos.z} + local below_node = minetest.get_node(below_pos) + if below_node.name ~= "air" then + return + end + minetest.set_node( + below_pos, + { + name="mcl_core:water_flowing", + param2 = 15, + } + ) + neighbours_pos = { + {x=below_pos.x+1, y=below_pos.y, z=below_pos.z}, + {x=below_pos.x-1, y=below_pos.y, z=below_pos.z}, + {x=below_pos.x, y=below_pos.y, z=below_pos.z+1}, + {x=below_pos.x, y=below_pos.y, z=below_pos.z-1}, + } + for _, neighbour_pos in ipairs(neighbours_pos) do + cool_lava_next_to_water_flow(neighbour_pos) + end + end + -- local below_pos = {x=pos.x, y=pos.y-1, z=pos.z} + -- local below_node = minetest.get_node(below_pos) + -- flow_water_downwards( + -- below_pos, + -- below_node, + -- 20 + -- ) end, })