flowing_logic.lua: fix pressure limit bug due to accessing non-existant variable

This commit is contained in:
thetaepsilon-gamedev 2017-09-27 16:32:22 +01:00
parent 67350b55bb
commit c3708b154c

View File

@ -159,6 +159,10 @@ end
-- local debuglog = function(msg) print("## "..msg) end
-- new version of liquid check -- new version of liquid check
-- accepts a limit parameter to only delete water blocks that the receptacle can accept, -- accepts a limit parameter to only delete water blocks that the receptacle can accept,
-- and returns it so that the receptacle can update it's pressure values. -- and returns it so that the receptacle can update it's pressure values.
@ -217,13 +221,16 @@ pipeworks.balance_pressure = function(pos, node)
end end
end end
pipeworks.run_pump_intake = function(pos, node) pipeworks.run_pump_intake = function(pos, node)
-- try to absorb nearby water nodes, but only up to limit. -- try to absorb nearby water nodes, but only up to limit.
-- NB: check_for_liquids_v2 handles zero or negative from the following subtraction -- NB: check_for_liquids_v2 handles zero or negative from the following subtraction
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local currentpressure = meta:get_float(label_pressure) local currentpressure = meta:get_float(label_pressure)
local intake_limit = thresholds.pump_pressure - currentpressure local intake_limit = thresholds.pump_pressure - currentpressure
local actual_intake = pipeworks.check_for_liquids_v2(pos, limit) local actual_intake = pipeworks.check_for_liquids_v2(pos, intake_limit)
local newpressure = actual_intake + currentpressure local newpressure = actual_intake + currentpressure
-- debuglog("oldpressure "..currentpressure.." intake_limit "..intake_limit.." actual_intake "..actual_intake.." newpressure "..newpressure)
meta:set_float(label_pressure, newpressure) meta:set_float(label_pressure, newpressure)
end end