From 2132f8ecb6afcb94195f528b90794b4e5c200fb6 Mon Sep 17 00:00:00 2001 From: cheapie Date: Wed, 11 Jan 2017 01:04:47 -0600 Subject: Restart timers on block load --- init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/init.lua b/init.lua index 9f69988..e72dcc8 100644 --- a/init.lua +++ b/init.lua @@ -343,3 +343,21 @@ minetest.register_node("ltc4000e:controller", { }, }, }) + +--Make sure lights don't "stall" if unloaded +minetest.register_lbm({ + label = "Restart LTC-4000E timers", + name = "ltc4000e:restart_timers", + nodenames = {"ltc4000e:controller"}, + run_at_every_load = true, + action = function(pos) + local meta = minetest.get_meta(pos) + local mem = minetest.deserialize(meta:get_string("mem")) + if mem.cycle then + local event = {} + event.type = "interrupt" + event.iid = "tick" + run(pos,event) + end + end +}) -- cgit v1.2.3