aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_luaautomation
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/advtrains_luaautomation')
-rw-r--r--advtrains/advtrains_luaautomation/init.lua6
-rw-r--r--advtrains/advtrains_luaautomation/interrupt.lua32
2 files changed, 18 insertions, 20 deletions
diff --git a/advtrains/advtrains_luaautomation/init.lua b/advtrains/advtrains_luaautomation/init.lua
index b24bc01..0257aef 100644
--- a/advtrains/advtrains_luaautomation/init.lua
+++ b/advtrains/advtrains_luaautomation/init.lua
@@ -62,10 +62,10 @@ function atlatc.load()
end
file:close()
end
+ -- run init code of all environments
+ atlatc.run_initcode()
end
--- run init code of all environments
-atlatc.run_initcode()
atlatc.save = function()
--versions:
@@ -107,4 +107,4 @@ function atlatc.mainloop_stepcode(dtime)
timer=0
atlatc.run_stepcode()
end
-end)
+end
diff --git a/advtrains/advtrains_luaautomation/interrupt.lua b/advtrains/advtrains_luaautomation/interrupt.lua
index fa340b8..718b8c7 100644
--- a/advtrains/advtrains_luaautomation/interrupt.lua
+++ b/advtrains/advtrains_luaautomation/interrupt.lua
@@ -22,26 +22,24 @@ function iq.add(t, pos, evtdata)
end
function iq.mainloop(dtime)
- if run then
- timer=timer + math.min(dtime, 0.2)
- for i=1,#queue do
- local qe=queue[i]
- if not qe then
- table.remove(queue, i)
- i=i-1
- elseif timer>qe.t then
- local pos, evtdata=queue[i].p, queue[i].e
- local node=advtrains.ndb.get_node(pos)
- local ndef=minetest.registered_nodes[node.name]
- if ndef and ndef.luaautomation and ndef.luaautomation.fire_event then
- ndef.luaautomation.fire_event(pos, evtdata)
- end
- table.remove(queue, i)
- i=i-1
+ timer=timer + math.min(dtime, 0.2)
+ for i=1,#queue do
+ local qe=queue[i]
+ if not qe then
+ table.remove(queue, i)
+ i=i-1
+ elseif timer>qe.t then
+ local pos, evtdata=queue[i].p, queue[i].e
+ local node=advtrains.ndb.get_node(pos)
+ local ndef=minetest.registered_nodes[node.name]
+ if ndef and ndef.luaautomation and ndef.luaautomation.fire_event then
+ ndef.luaautomation.fire_event(pos, evtdata)
end
+ table.remove(queue, i)
+ i=i-1
end
end
-end)
+end