diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 22:41:38 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-09-30 22:41:38 +0100 |
commit | 8dfbcad949b7751d4ddb56f033d82c0432d2e112 (patch) | |
tree | d7cd647735d8ae5e2207bd25f0d8af2f1939ce52 | |
parent | 0251baf692741c5cf3173ff9415c94dbbc3719f3 (diff) |
register_flow_logic.lua: begin refactoring abm registration to allow use by other mods
-rw-r--r-- | register_flow_logic.lua | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/register_flow_logic.lua b/register_flow_logic.lua index 3a8df8e..f82b8a9 100644 --- a/register_flow_logic.lua +++ b/register_flow_logic.lua @@ -17,15 +17,20 @@ if pipeworks.enable_pipes then }) end ]] --- flowables.register.simple takes care of creating an array-like table of node names -minetest.register_abm({ - nodenames = pipeworks.flowables.list.simple_nodenames, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - pipeworks.flowlogic.balance_pressure(pos, node) - end -}) + +local register_abm_balance = function(nodename) + minetest.register_abm({ + nodenames = { nodename }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + pipeworks.flowlogic.balance_pressure(pos, node) + end + }) +end +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 |