summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 16:20:07 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-27 16:20:07 +0100
commit67350b55bb00a8787ebfa3e5ab6763748cfd792d (patch)
tree73dc6b2f58f5177d048d87c71c54457ccfd8171c
parentc5e5aa069fd45ba8d617bf4192f59699ddcdb186 (diff)
downloadpipeworks-67350b55bb00a8787ebfa3e5ab6763748cfd792d.tar
pipeworks-67350b55bb00a8787ebfa3e5ab6763748cfd792d.tar.gz
pipeworks-67350b55bb00a8787ebfa3e5ab6763748cfd792d.tar.bz2
pipeworks-67350b55bb00a8787ebfa3e5ab6763748cfd792d.tar.xz
pipeworks-67350b55bb00a8787ebfa3e5ab6763748cfd792d.zip
pipes.lua: wire up pump intake ABM and add pumps to balancing logic
-rw-r--r--pipes.lua21
1 files changed, 20 insertions, 1 deletions
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