summaryrefslogtreecommitdiff
path: root/new_flow_logic/flowable_node_registry.lua
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-01 00:13:43 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-10-01 00:16:37 +0100
commitec9cf1df5019c915cf7f5776c90cca760670569f (patch)
tree359fa8fa309bc0baa74a38f4f3680ad4f56362a5 /new_flow_logic/flowable_node_registry.lua
parent31741e33e20c2ed366f80c01c7d6b4a6a23e0d4c (diff)
downloadpipeworks-ec9cf1df5019c915cf7f5776c90cca760670569f.tar
pipeworks-ec9cf1df5019c915cf7f5776c90cca760670569f.tar.gz
pipeworks-ec9cf1df5019c915cf7f5776c90cca760670569f.tar.bz2
pipeworks-ec9cf1df5019c915cf7f5776c90cca760670569f.tar.xz
pipeworks-ec9cf1df5019c915cf7f5776c90cca760670569f.zip
new_flow_logic/flowable_node_registry.lua: integrate existing ABM registration from register_local_pipes.lua
Diffstat (limited to 'new_flow_logic/flowable_node_registry.lua')
-rw-r--r--new_flow_logic/flowable_node_registry.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/new_flow_logic/flowable_node_registry.lua b/new_flow_logic/flowable_node_registry.lua
index def9649..3cb2a67 100644
--- a/new_flow_logic/flowable_node_registry.lua
+++ b/new_flow_logic/flowable_node_registry.lua
@@ -1,6 +1,9 @@
-- registration code for nodes under new flow logic
-- written 2017 by thetaepsilon
+-- use for hooking up ABMs as nodes are registered
+local abmregister = pipeworks.flowlogic.abmregister
+
pipeworks.flowables = {}
pipeworks.flowables.list = {}
pipeworks.flowables.list.all = {}
@@ -34,12 +37,13 @@ end
-- Register a node as a simple flowable.
-- Simple flowable nodes have no considerations for direction of flow;
-- A cluster of adjacent simple flowables will happily average out in any direction.
--- This does *not* register the ABM, as that is done in register_flow_logic.lua;
--- this is so that the new flow logic can remain optional during development.
register.simple = function(nodename)
insertbase(nodename)
pipeworks.flowables.list.simple[nodename] = true
table.insert(pipeworks.flowables.list.simple_nodenames, nodename)
+ if pipeworks.enable_new_flow_logic then
+ abmregister.balance(nodename)
+ end
end
local checkbase = function(nodename)
@@ -56,4 +60,7 @@ register.intake_simple = function(nodename, maxpressure)
checkbase(nodename)
pipeworks.flowables.inputs.list[nodename] = { maxpressure=maxpressure }
table.insert(pipeworks.flowables.inputs.nodenames, nodename)
+ if pipeworks.enable_new_flow_logic then
+ abmregister.input(nodename, maxpressure)
+ end
end