summaryrefslogtreecommitdiff
path: root/new_flow_logic
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 22:21:54 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 22:21:54 +0100
commit9ab197af2f6e524be920857c0f152aef84546e37 (patch)
treec00295c03b14236b2e6f9a3f882d4d0038ae5ebe /new_flow_logic
parent07e769d1b92661dc21bf85dee2f788f929fc444e (diff)
downloadpipeworks-9ab197af2f6e524be920857c0f152aef84546e37.tar
pipeworks-9ab197af2f6e524be920857c0f152aef84546e37.tar.gz
pipeworks-9ab197af2f6e524be920857c0f152aef84546e37.tar.bz2
pipeworks-9ab197af2f6e524be920857c0f152aef84546e37.tar.xz
pipeworks-9ab197af2f6e524be920857c0f152aef84546e37.zip
new flow logic: abms.lua: implement non-finite mode behaviour for neighbour output helper
Diffstat (limited to 'new_flow_logic')
-rw-r--r--new_flow_logic/abms.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/new_flow_logic/abms.lua b/new_flow_logic/abms.lua
index a4d5fc3..99ccbc6 100644
--- a/new_flow_logic/abms.lua
+++ b/new_flow_logic/abms.lua
@@ -178,9 +178,18 @@ flowlogic.helpers.make_neighbour_output_fixed = function(neighbours)
for _, offset in pairs(neighbours) do
local npos = vector.add(pos, offset)
local name = minetest.get_node(npos).name
- if (name == "air") or (name == "default:water_flowing") then
+ if currentpressure < 1 then break end
+ -- take pressure anyway in non-finite mode, even if node is water source already.
+ -- in non-finite mode, pressure has to be sustained to keep the sources there.
+ -- so in non-finite mode, placing water is dependent on the target node;
+ -- draining pressure is not.
+ local canplace = (name == "air") or (name == "default:water_flowing")
+ if canplace then
minetest.swap_node(npos, {name="default:water_source"})
+ end
+ if (not finitemode) or canplace then
taken = taken + 1
+ currentpressure = currentpressure - 1
end
end
return taken