aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/active_common.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-02-17 19:45:52 +0100
committerorwell96 <orwell@bleipb.de>2021-02-17 19:45:52 +0100
commit04c78373f1db0b011557b92cd6fb58268cbeefe4 (patch)
tree8d79d0b946d2bd59d4e9bf891d120e18ae4630a8 /advtrains_luaautomation/active_common.lua
parent1e4156d0a4e42b519ca2f64f4146c7a7faec49a3 (diff)
downloadadvtrains-04c78373f1db0b011557b92cd6fb58268cbeefe4.tar.gz
advtrains-04c78373f1db0b011557b92cd6fb58268cbeefe4.tar.bz2
advtrains-04c78373f1db0b011557b92cd6fb58268cbeefe4.zip
LuaATC: add interrupt_safe() and clear_interrupts(), fix queue mainloop
Diffstat (limited to 'advtrains_luaautomation/active_common.lua')
-rw-r--r--advtrains_luaautomation/active_common.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index f06eb51..d168bad 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -122,6 +122,18 @@ function ac.run_in_env(pos, evtdata, customfct_p)
assert(t >= 0)
atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field.
end
+ customfct.interrupt_safe=function(t, imesg)
+ assertt(t, "number")
+ assert(t >= 0)
+ if atlatc.interrupt.has_at_pos(pos) then
+ return false
+ end
+ atlatc.interrupt.add(t, pos, {type="int", int=true, message=imesg, msg=imesg}) --Compatiblity "message" field.
+ return true
+ end
+ customfct.clear_interrupts=function()
+ atlatc.interrupt.clear_ints_at_pos(pos)
+ end
-- add digiline_send function, if digiline is loaded
if minetest.global_exists("digiline") then
customfct.digiline_send=function(channel, msg)