aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_track
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-02-04 12:35:24 +0100
committerorwell96 <orwell@bleipb.de>2021-02-04 12:35:24 +0100
commite935136d58dc863541a6a53c6f5e9f9d218e6661 (patch)
tree50d1dea4941799bd095e920fb1e89c493d7d283b /advtrains_train_track
parent8ae405f00f7073bca8cb621612ab11bc730228a3 (diff)
downloadadvtrains-e935136d58dc863541a6a53c6f5e9f9d218e6661.tar.gz
advtrains-e935136d58dc863541a6a53c6f5e9f9d218e6661.tar.bz2
advtrains-e935136d58dc863541a6a53c6f5e9f9d218e6661.zip
Make is_node_loaded() checks also for mesecon interactions and digiline_send(), move on_updated_from_nodedb to advtrains table
Diffstat (limited to 'advtrains_train_track')
-rw-r--r--advtrains_train_track/init.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/advtrains_train_track/init.lua b/advtrains_train_track/init.lua
index 227bf02..7f1f73c 100644
--- a/advtrains_train_track/init.lua
+++ b/advtrains_train_track/init.lua
@@ -318,9 +318,14 @@ if mesecon then
}
},
advtrains = {
+ on_updated_from_nodedb = function(pos, node)
+ mesecon.receptor_off(pos, advtrains.meseconrules)
+ end,
on_train_enter=function(pos, train_id)
advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_on".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
- mesecon.receptor_on(pos, advtrains.meseconrules)
+ if advtrains.is_node_loaded(pos) then
+ mesecon.receptor_on(pos, advtrains.meseconrules)
+ end
end
}
}
@@ -343,9 +348,14 @@ if mesecon then
}
},
advtrains = {
+ on_updated_from_nodedb = function(pos, node)
+ mesecon.receptor_on(pos, advtrains.meseconrules)
+ end,
on_train_leave=function(pos, train_id)
advtrains.ndb.swap_node(pos, {name="advtrains:dtrack_detector_off".."_"..suffix..rotation, param2=advtrains.ndb.get_node(pos).param2})
- mesecon.receptor_off(pos, advtrains.meseconrules)
+ if advtrains.is_node_loaded(pos) then
+ mesecon.receptor_off(pos, advtrains.meseconrules)
+ end
end
}
}