summaryrefslogtreecommitdiff
path: root/new_flow_logic
diff options
context:
space:
mode:
Diffstat (limited to 'new_flow_logic')
-rw-r--r--new_flow_logic/flowable_node_registry.lua11
-rw-r--r--new_flow_logic/register_local_pipes.lua6
2 files changed, 9 insertions, 8 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
diff --git a/new_flow_logic/register_local_pipes.lua b/new_flow_logic/register_local_pipes.lua
index 6fe8b7e..62b787b 100644
--- a/new_flow_logic/register_local_pipes.lua
+++ b/new_flow_logic/register_local_pipes.lua
@@ -16,7 +16,6 @@ local pipes_full_nodenames = pipeworks.pipes_full_nodenames
local pipes_empty_nodenames = pipeworks.pipes_empty_nodenames
local register = pipeworks.flowables.register
-local abmregister = pipeworks.flowlogic.abmregister
@@ -42,12 +41,7 @@ if pipeworks.enable_pipes then
register.simple(pump_on)
register.simple(spigot_on)
register.simple(spigot_off)
- abmregister.balance(pump_off)
- abmregister.balance(pump_on)
- abmregister.balance(spigot_on)
- abmregister.balance(spigot_off)
register.intake_simple(pump_on, thresholds.pump_pressure)
- abmregister.input(pump_on, thresholds.pump_pressure)
end
end