mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-14 03:13:56 +01:00
flowing_logic.lua: add new version of check_for_liquids()
This commit is contained in:
parent
59ac978093
commit
6a0fe9f3c0
@ -149,6 +149,31 @@ local make_coords_offsets = function(pos, include_base)
|
|||||||
return coords
|
return coords
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- new version of liquid check
|
||||||
|
-- accepts a limit parameter to only delete water blocks that the receptacle can accept,
|
||||||
|
-- and returns it so that the receptacle can update it's pressure values.
|
||||||
|
-- this should ensure that water blocks aren't vanished from existance.
|
||||||
|
pipeworks.check_for_liquids_v2 = function(pos, limit)
|
||||||
|
if not limit then
|
||||||
|
limit = 6
|
||||||
|
end
|
||||||
|
local coords = make_coords_offsets(pos, false)
|
||||||
|
local total = 0
|
||||||
|
for index, tpos in ipairs(coords) do
|
||||||
|
if total >= limit then break end
|
||||||
|
local name = minetest.get_node(tpos).name
|
||||||
|
if name == "default:water_source" then
|
||||||
|
minetest.remove_node(tpos)
|
||||||
|
total = total + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return total
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local label_pressure = "pipeworks.water_pressure"
|
local label_pressure = "pipeworks.water_pressure"
|
||||||
local label_haspressure = "pipeworks.is_pressure_node"
|
local label_haspressure = "pipeworks.is_pressure_node"
|
||||||
pipeworks.balance_pressure = function(pos, node)
|
pipeworks.balance_pressure = function(pos, node)
|
||||||
|
Loading…
Reference in New Issue
Block a user