diff options
author | orwell96 <orwell@bleipb.de> | 2021-02-17 19:45:52 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2021-02-17 19:45:52 +0100 |
commit | 04c78373f1db0b011557b92cd6fb58268cbeefe4 (patch) | |
tree | 8d79d0b946d2bd59d4e9bf891d120e18ae4630a8 /advtrains_luaautomation/active_common.lua | |
parent | 1e4156d0a4e42b519ca2f64f4146c7a7faec49a3 (diff) | |
download | advtrains-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.lua | 12 |
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) |