From e615a1013b621daff64500fb74a6202fdca0093f Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sun, 1 Oct 2017 12:45:12 +0100 Subject: new flow logic: flowable_node_registry.lua: add output node registration --- new_flow_logic/flowable_node_registry.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'new_flow_logic') diff --git a/new_flow_logic/flowable_node_registry.lua b/new_flow_logic/flowable_node_registry.lua index 1465561..f3548a4 100644 --- a/new_flow_logic/flowable_node_registry.lua +++ b/new_flow_logic/flowable_node_registry.lua @@ -18,6 +18,11 @@ pipeworks.flowables.inputs = {} pipeworks.flowables.inputs.list = {} pipeworks.flowables.inputs.nodenames = {} +-- outputs - takes pressure from pipes and update world to do something with it +pipeworks.flowables.outputs = {} +pipeworks.flowables.outputs.list = {} +-- not currently any nodenames arraylist for this one as it's not currently needed. + -- registration functions pipeworks.flowables.register = {} local register = pipeworks.flowables.register @@ -63,3 +68,20 @@ register.intake_simple = function(nodename, maxpressure) abmregister.input(nodename, maxpressure, pipeworks.flowlogic.check_for_liquids_v2) end end + +-- Register a node as an output. +-- Expects node to already be a flowable. +-- threshold and outputfn are currently as documented for register_abm_output() in abm_register.lua. +register.output = function(nodename, threshold, outputfn) + checkbase(nodename) + pipeworks.flowables.outputs.list[nodename] = { threshold=threshold, outputfn=outputfn } + if pipeworks.enable_new_flow_logic then + abmregister.output(nodename, maxpressure, outputfn) + end +end + +-- TODOs here: +-- The spigot's output behaviour (and possibly the fountain) could be abstracted out into a "simple output" of sorts, +-- which tries to place water nodes around it. +-- possibly this could be given a helper function to determine which faces a node should try, +-- to allow things like rotation or other param values determining "direction" to be respected. -- cgit v1.2.3