summaryrefslogtreecommitdiff
path: root/new_flow_logic
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 21:55:49 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-07 21:55:49 +0100
commit453a114cd022a4d7b0a028f9e4a9785e20e6e368 (patch)
treee66ce742af0e9d60e90e7fc43d396d4113d6a899 /new_flow_logic
parent187e755aa5d7f4ddbc68cc2c4d8494051321a3cd (diff)
downloadpipeworks-453a114cd022a4d7b0a028f9e4a9785e20e6e368.tar
pipeworks-453a114cd022a4d7b0a028f9e4a9785e20e6e368.tar.gz
pipeworks-453a114cd022a4d7b0a028f9e4a9785e20e6e368.tar.bz2
pipeworks-453a114cd022a4d7b0a028f9e4a9785e20e6e368.tar.xz
pipeworks-453a114cd022a4d7b0a028f9e4a9785e20e6e368.zip
new flow logic: flowable_node_registry_install.lua: add cleanupfn argument to register.output()
Diffstat (limited to 'new_flow_logic')
-rw-r--r--new_flow_logic/flowable_node_registry_install.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/new_flow_logic/flowable_node_registry_install.lua b/new_flow_logic/flowable_node_registry_install.lua
index 6da87dc..0be9fc0 100644
--- a/new_flow_logic/flowable_node_registry_install.lua
+++ b/new_flow_logic/flowable_node_registry_install.lua
@@ -86,12 +86,17 @@ end
-- the upper and lower difference acts as a hysteresis to try and avoid "gaps" in the flow.
-- if finite mode is on, upper is ignored and lower is used to determine whether to run outputfn;
-- cleanupfn is ignored in this mode as finite mode assumes something causes water to move itself.
-register.output = function(nodename, upper, lower, outputfn)
+register.output = function(nodename, upper, lower, outputfn, cleanupfn)
if pipeworks.flowables.outputs.list[nodename] then
error("pipeworks.flowables.outputs duplicate registration!")
end
checkbase(nodename)
- pipeworks.flowables.outputs.list[nodename] = { upper=upper, lower=lower, outputfn=outputfn }
+ pipeworks.flowables.outputs.list[nodename] = {
+ upper=upper,
+ lower=lower,
+ outputfn=outputfn,
+ cleanupfn=cleanupfn,
+ }
-- output ABM now part of main flow logic ABM to preserve ordering.
-- note that because outputs have to be a flowable first
-- (and the installation of the flow logic ABM is conditional),
@@ -112,5 +117,6 @@ end
-- but only drains pressure when water source nodes are actually placed.
register.output_simple = function(nodename, upper, lower, neighbours)
local outputfn = pipeworks.flowlogic.helpers.make_neighbour_output_fixed(neighbours)
- register.output(nodename, upper, lower, outputfn)
+ local cleanupfn = pipeworks.flowlogic.helpers.make_neighbour_cleanup_fixed(neighbours)
+ register.output(nodename, upper, lower, outputfn, cleanupfn)
end