diff options
author | Jeija <jeija@mesecons.net> | 2014-01-19 13:59:22 +0100 |
---|---|---|
committer | Jeija <jeija@mesecons.net> | 2014-01-19 13:59:22 +0100 |
commit | 8a71f51b265e7f62dd070e9a9315ccc7abccc7c0 (patch) | |
tree | 6080a79bb6ada8550b4c64a0e238c28eab38f28a /mesecons_delayer | |
parent | 7517cc4af16f225ff2a48fa9f8ed82f608bf0082 (diff) | |
parent | a632a8abc80155118708108d846f52bbc230f257 (diff) | |
download | mesecons-8a71f51b265e7f62dd070e9a9315ccc7abccc7c0.tar mesecons-8a71f51b265e7f62dd070e9a9315ccc7abccc7c0.tar.gz mesecons-8a71f51b265e7f62dd070e9a9315ccc7abccc7c0.tar.bz2 mesecons-8a71f51b265e7f62dd070e9a9315ccc7abccc7c0.tar.xz mesecons-8a71f51b265e7f62dd070e9a9315ccc7abccc7c0.zip |
Merge branch 'actionqueue'
This introduces the ActionQueue, a new kind of MESECONS_GLOBALSTEP.
Circuits using delayers will now resume when restarting the server.
Also, large circuits should automatically resume if parts of them are
in unloaded chunks.
Old circuits e.g. using gates will not resume when mesecons is updated,
which means you have to restart them once. But after that, it should work
just like it used to.
This will fix a lot of stuff but may also introduce some new bugs.
So please report them!
Diffstat (limited to 'mesecons_delayer')
-rw-r--r-- | mesecons_delayer/init.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua index a03737c..4ec0ebc 100644 --- a/mesecons_delayer/init.lua +++ b/mesecons_delayer/init.lua @@ -17,28 +17,18 @@ end -- Functions that are called after the delay time -local delayer_turnon = function(params) - local rules = delayer_get_output_rules(params.node) - mesecon:receptor_on(params.pos, rules) -end - -local delayer_turnoff = function(params) - local rules = delayer_get_output_rules(params.node) - mesecon:receptor_off(params.pos, rules) -end - local delayer_activate = function(pos, node) local def = minetest.registered_nodes[node.name] local time = def.delayer_time minetest.swap_node(pos, {name = def.delayer_onstate, param2=node.param2}) - minetest.after(time, delayer_turnon , {pos = pos, node = node}) + mesecon.queue:add_action(pos, "receptor_on", {rules=delayer_get_output_rules(node)}, time, nil) end local delayer_deactivate = function(pos, node) local def = minetest.registered_nodes[node.name] local time = def.delayer_time minetest.swap_node(pos, {name = def.delayer_offstate, param2=node.param2}) - minetest.after(time, delayer_turnoff, {pos = pos, node = node}) + mesecon.queue:add_action(pos, "receptor_off", {rules=delayer_get_output_rules(node)}, time, nil) end -- Register the 2 (states) x 4 (delay times) delayers |