From e41167813ba15344e56a291f2cc03706cb62590e Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Mon, 16 Oct 2017 23:18:00 +0100 Subject: new flow logic: flowable node registry: add directional flow type class --- new_flow_logic/flowable_node_registry_install.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'new_flow_logic/flowable_node_registry_install.lua') diff --git a/new_flow_logic/flowable_node_registry_install.lua b/new_flow_logic/flowable_node_registry_install.lua index c8f6889..a49c31a 100644 --- a/new_flow_logic/flowable_node_registry_install.lua +++ b/new_flow_logic/flowable_node_registry_install.lua @@ -20,6 +20,9 @@ local insertbase = function(nodename) if checkexists(nodename) then error("pipeworks.flowables duplicate registration!") end pipeworks.flowables.list.all[nodename] = true -- table.insert(pipeworks.flowables.list.nodenames, nodename) + if pipeworks.toggles.pressure_logic then + abmregister.flowlogic(nodename) + end end local regwarning = function(kind, nodename) @@ -35,12 +38,19 @@ register.simple = function(nodename) insertbase(nodename) pipeworks.flowables.list.simple[nodename] = true table.insert(pipeworks.flowables.list.simple_nodenames, nodename) - if pipeworks.toggles.pressure_logic then - abmregister.flowlogic(nodename) - end regwarning("simple", nodename) end +-- Register a node as a directional flowable: +-- has a helper function which determines which nodes to consider valid neighbours. +register.directional = function(nodename, neighbourfn) + insertbase(nodename) + pipeworks.flowables.list.directional[nodename] = { neighbourfn = neighbourfn } + regwarning("directional", nodename) +end + + + local checkbase = function(nodename) if not checkexists(nodename) then error("pipeworks.flowables node doesn't exist as a flowable!") end end -- cgit v1.2.3