mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-24 18:00:22 +01:00
pipes.lua: wire up pump intake ABM and add pumps to balancing logic
This commit is contained in:
parent
c5e5aa069f
commit
67350b55bb
21
pipes.lua
21
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
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user