From de8ce5b68eedd51f30ac61b93e5a6878624a75f2 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Wed, 5 May 2021 21:20:51 +0200 Subject: [PATCH] start support of multiple absorbsion --- mods/ITEMS/mcl_sponges/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 9c339977eb..15cb55bd9c 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -67,16 +67,17 @@ function mcl_sponges.absorb(pos) -- to determine the wet sponge type. local river_water = 0 local non_river_water = 0 + local out = {} local p, n for i=-3,3 do for j=-3,3 do for k=-3,3 do - p = {x=pos.x+i, y=pos.y+j, z=pos.z+k} - n = minetest.get_node(p) - if minetest.get_item_group(n.name, "water") ~= 0 then - minetest.add_node(p, {name="air"}) + pos = {x=pos.x+i, y=pos.y+j, z=pos.z+k} + node = minetest.get_node(pos) + if minetest.get_item_group(node.name, "water") ~= 0 then + minetest.add_node(pos, {name="air"}) change = true - if n.name == "mclx_core:river_water_source" or n.name == "mclx_core:river_water_flowing" then + if node.name == "mclx_core:river_water_source" or node.name == "mclx_core:river_water_flowing" then river_water = river_water + 1 else non_river_water = non_river_water + 1