aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-11-06 22:07:10 +0100
committerorwell96 <orwell@bleipb.de>2019-11-06 22:07:10 +0100
commit8c55442076c9d5cfed89bac3f4acd22ea7948dd3 (patch)
tree170bd44fdd0c015b9995e0cdb483e5f270433af4 /advtrains_luaautomation
parent43b4d863ec379f5b2639194b929a45fd3a18be78 (diff)
downloadadvtrains-8c55442076c9d5cfed89bac3f4acd22ea7948dd3.tar.gz
advtrains-8c55442076c9d5cfed89bac3f4acd22ea7948dd3.tar.bz2
advtrains-8c55442076c9d5cfed89bac3f4acd22ea7948dd3.zip
Add "discard all" function to scheduler events and use it to clear schedules in luaatc rails
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/active_common.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index 8d0975f..3dc018d 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -71,7 +71,12 @@ function ac.on_receive_fields(pos, formname, fields, player)
nodetbl.code=fields.code
end
if fields.save then
+ -- reset certain things
nodetbl.err=nil
+ if advtrains.lines and advtrains.lines.sched then
+ -- discard all schedules for this node
+ advtrains.lines.sched.discard_all(advtrains.encode_pos(pos))
+ end
end
if fields.cle then
nodetbl.data={}