2017-09-27 18:00:18 +02:00
|
|
|
-- register new flow logic ABMs
|
2017-09-27 18:54:03 +02:00
|
|
|
-- written 2017 by thetaepsilon
|
2017-09-27 18:00:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-10-01 00:02:11 +02:00
|
|
|
local register = {}
|
|
|
|
pipeworks.flowlogic.abmregister = register
|
|
|
|
|
2017-10-01 13:34:20 +02:00
|
|
|
local flowlogic = pipeworks.flowlogic
|
2017-10-01 00:02:11 +02:00
|
|
|
|
2017-10-01 13:34:20 +02:00
|
|
|
-- 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.
|
2017-10-01 00:02:11 +02:00
|
|
|
|
2017-10-07 17:12:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
-- register node list for the main logic function.
|
|
|
|
-- see flowlogic.run() in abms.lua.
|
2017-10-07 18:33:42 +02:00
|
|
|
|
2017-10-07 17:12:36 +02:00
|
|
|
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
|
|
|
|
})
|
|
|
|
end
|
2017-10-07 18:33:42 +02:00
|
|
|
register.flowlogic = register_flowlogic_abm
|