diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-01 12:45:12 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-01 12:45:12 +0100 |
commit | e615a1013b621daff64500fb74a6202fdca0093f (patch) | |
tree | 7bd328374b3c3534fd334a3c15c3a5d872623202 | |
parent | f3a94fcd248df35b4afb992941a58af4cc17f446 (diff) | |
download | pipeworks-e615a1013b621daff64500fb74a6202fdca0093f.tar pipeworks-e615a1013b621daff64500fb74a6202fdca0093f.tar.gz pipeworks-e615a1013b621daff64500fb74a6202fdca0093f.tar.bz2 pipeworks-e615a1013b621daff64500fb74a6202fdca0093f.tar.xz pipeworks-e615a1013b621daff64500fb74a6202fdca0093f.zip |
new flow logic: flowable_node_registry.lua: add output node registration
-rw-r--r-- | new_flow_logic/flowable_node_registry.lua | 22 |
1 files changed, 22 insertions, 0 deletions
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. |