1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-28 03:40:25 +01:00
pipeworks/todo/new_flow_logic.txt
2017-10-07 19:42:49 +01:00

17 lines
1.9 KiB
Plaintext

-- Directionality code
Currently, only "simple" flowable nodes exist, and they will always equalise pressure with all six neighbours.
A more sophisticated behaviour for this would be flowable node registration with some kind of custom callback, such that water can only flow into or out of these nodes in certain directions.
This would enable devices such as the airtight panels, sensor tubes and valves to have correct flow behaviour.
-- Implement clean-up functionality for output nodes in non-finite mode
register.output() needs to be equipped with an extra "cleanerfn" argument, which is saved into the node's output table entry.
When the pressure level falls below the lower level in non-finite mode, this function would be called by run_output() to e.g. remove a created water source.
Additionally, the outputfn needs to be equipped with a flag to convey the finite mode, so that in non-finite mode the outputfn will drain pressure continuously until the pressure falls below the threshold.
-- Automated switching between node variants based on pressure thresholds
Within flowlogic.run(), an additional hook which would be useful is a "node changer" callback, to switch between variations of a pipe depending on pressure level.
For regular pipes, this is mostly aesthetic, as the empty/loaded variants of the pipes have different texures.
However, the flow sensor is currently a broken device under the new flow logic, as there is nothing to switch this device between the "on" and "off" state - in order to produce a mesecons output, separate nodes are required due to mesecon's API being limited to only on/off for a given node, with no facility for a callback function which could e.g. inspect pressure metadata.
To make this work, a new registry table would be needed to check if a flowable node has this property.
In terms of ordering, this callback should be run after outputs have been processed.