summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-30 22:56:12 +0100
committerthetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com>2017-09-30 22:56:12 +0100
commitaaef5eb22b439c3e410942c39726e58c0c041c40 (patch)
tree7505b4e6406d3c8d312e2bfbe2d7dd5793505686
parent7498a32364fd859d6b735661fc3de4281f75389a (diff)
downloadpipeworks-aaef5eb22b439c3e410942c39726e58c0c041c40.tar
pipeworks-aaef5eb22b439c3e410942c39726e58c0c041c40.tar.gz
pipeworks-aaef5eb22b439c3e410942c39726e58c0c041c40.tar.bz2
pipeworks-aaef5eb22b439c3e410942c39726e58c0c041c40.tar.xz
pipeworks-aaef5eb22b439c3e410942c39726e58c0c041c40.zip
register_flow_logic.lua: factor out per-node input ABM registration
-rw-r--r--register_flow_logic.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/register_flow_logic.lua b/register_flow_logic.lua
index f82b8a9..60fc820 100644
--- a/register_flow_logic.lua
+++ b/register_flow_logic.lua
@@ -32,16 +32,22 @@ for nodename, _ in pairs(pipeworks.flowables.list.simple) do
register_abm_balance(nodename)
end
-if pipeworks.enable_pipe_devices then
- -- absorb water into pumps if it'll fit
+local register_abm_input = function(nodename, properties)
minetest.register_abm({
- nodenames = pipeworks.flowables.inputs.nodenames,
+ nodenames = { nodename },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
pipeworks.flowlogic.run_pump_intake(pos, node)
end
})
+end
+
+if pipeworks.enable_pipe_devices then
+ -- absorb water into pumps if it'll fit
+ for nodename, properties in pairs(pipeworks.flowables.inputs.list) do
+ register_abm_input(nodename, properties)
+ end
-- output water from spigots
-- add both "on/off" spigots so one can be used to indicate a certain level of fluid.