forked from mtcontrib/pipeworks
pipes.lua: wire up pump intake ABM and add pumps to balancing logic
This commit is contained in:
parent
c5e5aa069f
commit
67350b55bb
19
pipes.lua
19
pipes.lua
@ -239,10 +239,19 @@ else
|
|||||||
|
|
||||||
|
|
||||||
-- run pressure balancing ABM over all water-moving nodes
|
-- 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
|
local pipes_all_nodenames = pipes_full_nodenames
|
||||||
for _, pipe in ipairs(pipes_empty_nodenames) do
|
for _, pipe in ipairs(pipes_empty_nodenames) do
|
||||||
table.insert(pipes_all_nodenames, pipe)
|
table.insert(pipes_all_nodenames, pipe)
|
||||||
end
|
end
|
||||||
|
table.insert(pipes_all_nodenames, pump_off)
|
||||||
|
table.insert(pipes_all_nodenames, pump_on)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = pipes_all_nodenames,
|
nodenames = pipes_all_nodenames,
|
||||||
interval = 1,
|
interval = 1,
|
||||||
@ -252,6 +261,16 @@ minetest.register_abm({
|
|||||||
end
|
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
|
Loading…
Reference in New Issue
Block a user