diff options
Diffstat (limited to 'pressure_logic/abm_register.lua')
-rw-r--r-- | pressure_logic/abm_register.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pressure_logic/abm_register.lua b/pressure_logic/abm_register.lua new file mode 100644 index 0000000..a8e3abc --- /dev/null +++ b/pressure_logic/abm_register.lua @@ -0,0 +1,27 @@ +-- 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({ + label = "pipeworks new_flow_logic run", + 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 |