diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-08 19:11:58 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-08 19:11:58 +0100 |
commit | 72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4 (patch) | |
tree | 60d93deb91c9ddf0288132799aafdef0c058b4ca /new_flow_logic | |
parent | 084174123df3264744743072c315be80f1f36d4d (diff) | |
download | pipeworks-72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4.tar pipeworks-72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4.tar.gz pipeworks-72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4.tar.bz2 pipeworks-72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4.tar.xz pipeworks-72f793e2b3a7de1ed2946424eedc3fb2b0d3a1b4.zip |
new flow logic: abm_register.lua: add extra safeguarding for conditional activation of new flow logic
Diffstat (limited to 'new_flow_logic')
-rw-r--r-- | new_flow_logic/abm_register.lua | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/new_flow_logic/abm_register.lua b/new_flow_logic/abm_register.lua index ac7b2e3..1d038d6 100644 --- a/new_flow_logic/abm_register.lua +++ b/new_flow_logic/abm_register.lua @@ -1,30 +1,26 @@ -- register new flow logic ABMs -- written 2017 by thetaepsilon - - local register = {} pipeworks.flowlogic.abmregister = register local flowlogic = pipeworks.flowlogic --- A possible DRY violation here... --- DISCUSS: should it be possible later on to raise the the rate of ABMs, or lower the chance? --- Currently all the intervals and chances are hardcoded below. - - - -- register node list for the main logic function. -- see flowlogic.run() in abms.lua. local register_flowlogic_abm = function(nodename) - 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 - }) + 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 |