pipes.lua: wire up pump intake ABM and add pumps to balancing logic

This commit is contained in:
thetaepsilon-gamedev 2017-09-27 16:20:07 +01:00
parent c5e5aa069f
commit 67350b55bb
1 changed files with 20 additions and 1 deletions

View File

@ -239,10 +239,19 @@ else
-- run pressure balancing ABM over all water-moving nodes
-- FIXME: DRY principle, get this from elsewhere in the code
local pump_on = "pipeworks:pump_on"
local pump_off = "pipeworks:pump_off"
local pipes_all_nodenames = pipes_full_nodenames
for _, pipe in ipairs(pipes_empty_nodenames) do
table.insert(pipes_all_nodenames, pipe)
end
table.insert(pipes_all_nodenames, pump_off)
table.insert(pipes_all_nodenames, pump_on)
minetest.register_abm({
nodenames = pipes_all_nodenames,
interval = 1,
@ -252,6 +261,16 @@ minetest.register_abm({
end
})
-- absorb water into pumps if it'll fit
minetest.register_abm({
nodenames = { pump_on },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks.run_pump_intake(pos, node)
end
})
end
end