summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2017-01-11 01:04:47 -0600
committercheapie <no-email-for-you@example.com>2017-01-11 01:04:47 -0600
commit2132f8ecb6afcb94195f528b90794b4e5c200fb6 (patch)
tree1ba50ad595595ef1fdb3034cc3ff60537cbde043
parent26c80f7ea0d7c2f37ed367dd67fd19bb5e0d92a1 (diff)
downloadltc4000e-2132f8ecb6afcb94195f528b90794b4e5c200fb6.tar
ltc4000e-2132f8ecb6afcb94195f528b90794b4e5c200fb6.tar.gz
ltc4000e-2132f8ecb6afcb94195f528b90794b4e5c200fb6.tar.bz2
ltc4000e-2132f8ecb6afcb94195f528b90794b4e5c200fb6.tar.xz
ltc4000e-2132f8ecb6afcb94195f528b90794b4e5c200fb6.zip
Restart timers on block load
-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
+})