From 67350b55bb00a8787ebfa3e5ab6763748cfd792d Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Wed, 27 Sep 2017 16:20:07 +0100 Subject: pipes.lua: wire up pump intake ABM and add pumps to balancing logic --- pipes.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'pipes.lua') diff --git a/pipes.lua b/pipes.lua index 29f91d3..4b0b102 100644 --- a/pipes.lua +++ b/pipes.lua @@ -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 \ No newline at end of file +end -- cgit v1.2.3