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-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)
|
2017-10-08 20:11:58 +02:00
|
|
|
if pipeworks.toggles.pressure_logic then
|
|
|
|
minetest.register_abm({
|
2017-10-16 22:01:09 +02:00
|
|
|
label = "pipeworks new_flow_logic run",
|
2017-10-08 20:11:58 +02:00
|
|
|
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
|
2017-10-07 17:12:36 +02:00
|
|
|
end
|
2017-10-07 18:33:42 +02:00
|
|
|
register.flowlogic = register_flowlogic_abm
|