forked from VoxeLibre/VoxeLibre
WIP liquid count
This commit is contained in:
parent
de8ce5b68e
commit
451a59c8a8
|
@ -63,10 +63,8 @@ end
|
||||||
|
|
||||||
function mcl_sponges.absorb(pos)
|
function mcl_sponges.absorb(pos)
|
||||||
local change = false
|
local change = false
|
||||||
-- Count number of absorbed river water vs other nodes
|
-- Count number of absorbed liquid by type vs other nodes
|
||||||
-- to determine the wet sponge type.
|
-- to determine the wet sponge type.
|
||||||
local river_water = 0
|
|
||||||
local non_river_water = 0
|
|
||||||
local out = {}
|
local out = {}
|
||||||
local p, n
|
local p, n
|
||||||
for i=-3,3 do
|
for i=-3,3 do
|
||||||
|
@ -74,13 +72,12 @@ function mcl_sponges.absorb(pos)
|
||||||
for k=-3,3 do
|
for k=-3,3 do
|
||||||
pos = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
pos = {x=pos.x+i, y=pos.y+j, z=pos.z+k}
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos)
|
||||||
if minetest.get_item_group(node.name, "water") ~= 0 then
|
for name,def in mcl_sponges.registered_sponges do
|
||||||
minetest.add_node(pos, {name="air"})
|
if minetest.get_item_group(node.name, def.liquidgroup) ~= 0 then
|
||||||
change = true
|
minetest.add_node(pos, {name="air"})
|
||||||
if node.name == "mclx_core:river_water_source" or node.name == "mclx_core:river_water_flowing" then
|
change = true
|
||||||
river_water = river_water + 1
|
out[name] = out[name]+1
|
||||||
else
|
break
|
||||||
non_river_water = non_river_water + 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue