From d7e5309833bc7044447982424dc8431d84d7a1a0 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 8 Jan 2017 01:23:10 -0700 Subject: 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. --- util_execute_cycle.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'util_execute_cycle.lua') 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 -- cgit v1.2.3