summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua18
1 files changed, 18 insertions, 0 deletions
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
+})