From d4346919bcb4d2e0c692448bc0a652d55c0fa2a9 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sat, 7 Oct 2017 22:29:17 +0100 Subject: [PATCH] new flow logic: abms.lua: pass initial pressure to run_output() to allow falling-level event detection --- new_flow_logic/abms.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/new_flow_logic/abms.lua b/new_flow_logic/abms.lua index 99ccbc6..babd14e 100644 --- a/new_flow_logic/abms.lua +++ b/new_flow_logic/abms.lua @@ -81,6 +81,7 @@ flowlogic.run = function(pos, node) -- get the current pressure value. local nodepressure = get_pressure_access(pos) local currentpressure = nodepressure.get() + local oldpressure = currentpressure -- if node is an input: run intake phase local inputdef = pipeworks.flowables.inputs.list[nodename] @@ -100,6 +101,7 @@ flowlogic.run = function(pos, node) pos, node, currentpressure, + oldpressure, outputdef, finitemode) end @@ -213,7 +215,7 @@ end -flowlogic.run_output = function(pos, node, currentpressure, outputdef, finitemode) +flowlogic.run_output = function(pos, node, currentpressure, oldpressure, outputdef, finitemode) -- processing step for water output devices. -- takes care of checking a minimum pressure value and updating the resulting pressure level -- the outputfn is provided the current pressure and returns the pressure "taken".