49.500 Error MainLoop.cpp:1035: Exception at tick 4643240: Error while running event LTNCompanion::on_tick (ID 0)
LuaTrain API call when LuaTrain was invalid.
stack traceback:
__LTNCompanion__/ltnc/data_processing.lua:184: in function 'update_depots'
__LTNCompanion__/ltnc/data_processing.lua:434: in function <__LTNCompanion__/ltnc/data_processing.lua:383>
Seems like you use the cached trains without checking validity.
Trains become invalid all the time when something like Noxys Multidirectional trains starts recreating them to roatate locomotives. LTN just started supporting such mods.
I do all that migrating already in LTN, so if you want to save performance let your train updates run only on the same tick when you get the LTN event. I can almost guarantee trains will be valid on that tick.
Seems like you use the cached trains without checking validity. Trains become invalid all the time when something like Noxys Multidirectional trains starts recreating them to roatate locomotives. LTN just started supporting such mods.
I do all that migrating already in LTN, so if you want to save performance let your train updates run only on the same tick when you get the LTN event. I can almost guarantee trains will be valid on that tick.
Quick fix: changing https://github.com/eduran84/LTN-Companion/blob/5781d28d9dbcb5fc347ddfcda0b1308695431806/ltnc/data_processing.lua#L182 to
if train and train.valid then
prevents the error, but I have no idea what skipping over this part might cause.