forked from mtcontrib/pipeworks
new flow logic: abms.lua: implement non-finite mode cleanupfn invocation in run_output()
This commit is contained in:
parent
d4346919bc
commit
f94c93bb59
@ -224,11 +224,16 @@ flowlogic.run_output = function(pos, node, currentpressure, oldpressure, outputd
|
|||||||
local upper = outputdef.upper
|
local upper = outputdef.upper
|
||||||
local lower = outputdef.lower
|
local lower = outputdef.lower
|
||||||
local result = currentpressure
|
local result = currentpressure
|
||||||
if currentpressure > lower then
|
local threshold = nil
|
||||||
|
if finitemode then threshold = lower else threshold = upper end
|
||||||
|
if currentpressure > threshold then
|
||||||
local takenpressure = outputdef.outputfn(pos, node, currentpressure, finitemode)
|
local takenpressure = outputdef.outputfn(pos, node, currentpressure, finitemode)
|
||||||
local newpressure = currentpressure - takenpressure
|
local newpressure = currentpressure - takenpressure
|
||||||
if newpressure < 0 then newpressure = 0 end
|
if newpressure < 0 then newpressure = 0 end
|
||||||
result = newpressure
|
result = newpressure
|
||||||
end
|
end
|
||||||
|
if (not finitemode) and (currentpressure < lower) and (oldpressure > lower) then
|
||||||
|
outputdef.cleanupfn(pos, node, currentpressure)
|
||||||
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user