summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 15:49:03 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 15:49:03 +0100
commit6a0fe9f3c0797fb18f3613b35251536f84424d01 (patch)
treedbcebb48a223de2c350a8e4890e47f8609aae7f2
parent59ac9780939b9c130bb70034bccb04ff1e99136d (diff)
downloadpipeworks-6a0fe9f3c0797fb18f3613b35251536f84424d01.tar
pipeworks-6a0fe9f3c0797fb18f3613b35251536f84424d01.tar.gz
pipeworks-6a0fe9f3c0797fb18f3613b35251536f84424d01.tar.bz2
pipeworks-6a0fe9f3c0797fb18f3613b35251536f84424d01.tar.xz
pipeworks-6a0fe9f3c0797fb18f3613b35251536f84424d01.zip
flowing_logic.lua: add new version of check_for_liquids()
-rw-r--r--flowing_logic.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/flowing_logic.lua b/flowing_logic.lua
index ee34ed0..1c02d36 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -149,6 +149,31 @@ local make_coords_offsets = function(pos, include_base)
return coords
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_haspressure = "pipeworks.is_pressure_node"
pipeworks.balance_pressure = function(pos, node)