summaryrefslogtreecommitdiff
path: root/new_flow_logic/abm_register.lua
diff options
context:
space:
mode:
authorroot <root@linuxworks.belug.de>2017-10-15 19:56:05 +0200
committerroot <root@linuxworks.belug.de>2017-10-15 19:56:05 +0200
commit848741a294363431a2a6e9c32ddf693951951fec (patch)
tree011f49ffd45455c86022e79dd2207f9ec002de42 /new_flow_logic/abm_register.lua
parent7e390cfda2bafb000c1d6688da472a71e591bc94 (diff)
parent30bedbfecc57f515f3c8578e225e27671e52316b (diff)
Merge branch 'master' of https://github.com/minetest-mods/pipeworks
Diffstat (limited to 'new_flow_logic/abm_register.lua')
-rw-r--r--new_flow_logic/abm_register.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/new_flow_logic/abm_register.lua b/new_flow_logic/abm_register.lua
new file mode 100644
index 0000000..1d038d6
--- /dev/null
+++ b/new_flow_logic/abm_register.lua
@@ -0,0 +1,26 @@
+-- register new flow logic ABMs
+-- written 2017 by thetaepsilon
+
+local register = {}
+pipeworks.flowlogic.abmregister = register
+
+local flowlogic = pipeworks.flowlogic
+
+-- register node list for the main logic function.
+-- see flowlogic.run() in abms.lua.
+
+local register_flowlogic_abm = function(nodename)
+ if pipeworks.toggles.pressure_logic then
+ minetest.register_abm({
+ nodenames = { nodename },
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ flowlogic.run(pos, node)
+ end
+ })
+ else
+ minetest.log("warning", "pipeworks pressure_logic not enabled but register.flowlogic() requested")
+ end
+end
+register.flowlogic = register_flowlogic_abm