diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-01-08 01:23:10 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-01-08 01:23:10 -0700 |
commit | d7e5309833bc7044447982424dc8431d84d7a1a0 (patch) | |
tree | db1081d61fd650db0593ef190b0bb32f93a19b3a /util_execute_cycle.lua | |
parent | e704249735372a3232883cc8b7f25679f4949a8d (diff) |
Added a rotation controller
Well that was a lot of work. Also, switched the "waiting" timer
management to the actual on_timer system - I noticed that minetest.after
wasn't persisting through server shutdown and restart, that could put a
controller in a "broken" state.
Diffstat (limited to 'util_execute_cycle.lua')
-rw-r--r-- | util_execute_cycle.lua | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua index 0fe212e..c9614d5 100644 --- a/util_execute_cycle.lua +++ b/util_execute_cycle.lua @@ -122,11 +122,7 @@ digtron.execute_cycle = function(pos, clicker) if not can_move then -- mark this node as waiting, will clear this flag in digtron.cycle_time seconds minetest.get_meta(pos):set_string("waiting", "true") - minetest.after(digtron.cycle_time, - function (pos) - minetest.get_meta(pos):set_string("waiting", nil) - end, pos - ) + minetest.get_node_timer(pos):start(digtron.cycle_time) minetest.sound_play("squeal", {gain=1.0, pos=pos}) minetest.sound_play("buzzer", {gain=0.5, pos=pos}) return pos, "Digtron is obstructed.\n" .. status_text, 3 --Abort, don't dig and don't build. @@ -181,11 +177,7 @@ digtron.execute_cycle = function(pos, clicker) if not can_build then minetest.get_meta(pos):set_string("waiting", "true") - minetest.after(digtron.cycle_time, - function (pos) - minetest.get_meta(pos):set_string("waiting", nil) - end, pos - ) + minetest.get_node_timer(pos):start(digtron.cycle_time) local return_string = nil local return_code = 5 if test_build_return_code == 3 then |