diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 20:16:00 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 21:27:50 +0100 |
commit | 40eeaac2ecb25dbc55f7315342e74723d6248534 (patch) | |
tree | c01da4e9ac67d84b372a69ef3b781020afb68af5 /new_flow_logic.lua | |
parent | 10221c6c153e4d20bf1d289fe218d29477400a4d (diff) | |
download | pipeworks-40eeaac2ecb25dbc55f7315342e74723d6248534.tar pipeworks-40eeaac2ecb25dbc55f7315342e74723d6248534.tar.gz pipeworks-40eeaac2ecb25dbc55f7315342e74723d6248534.tar.bz2 pipeworks-40eeaac2ecb25dbc55f7315342e74723d6248534.tar.xz pipeworks-40eeaac2ecb25dbc55f7315342e74723d6248534.zip |
internal refactoring of flowable node registration in preparation for enhanced flow checking logic
Diffstat (limited to 'new_flow_logic.lua')
-rw-r--r-- | new_flow_logic.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/new_flow_logic.lua b/new_flow_logic.lua index 3fd1bb6..1b4abf4 100644 --- a/new_flow_logic.lua +++ b/new_flow_logic.lua @@ -3,14 +3,6 @@ --- global values and thresholds for water behaviour --- TODO: add some way of setting this per-world -local thresholds = {} --- limit on pump pressure - will not absorb more than can be taken -thresholds.pump_pressure = 2 - - - -- borrowed from above: might be useable to replace the above coords tables local make_coords_offsets = function(pos, include_base) local coords = { @@ -95,9 +87,14 @@ end pipeworks.run_pump_intake = function(pos, node) -- try to absorb nearby water nodes, but only up to limit. -- NB: check_for_liquids_v2 handles zero or negative from the following subtraction + + local properties = pipeworks.flowables.inputs.list[node.name] + local maxpressure = properties.maxpressure + local meta = minetest.get_meta(pos) local currentpressure = meta:get_float(label_pressure) - local intake_limit = thresholds.pump_pressure - currentpressure + + local intake_limit = maxpressure - currentpressure local actual_intake = pipeworks.check_for_liquids_v2(pos, intake_limit) local newpressure = actual_intake + currentpressure -- debuglog("oldpressure "..currentpressure.." intake_limit "..intake_limit.." actual_intake "..actual_intake.." newpressure "..newpressure) |