Automatic Train Painter


Automatically colors locomotives and wagons based on their contents.

Tweaks
a month ago
0.17 - 2.0
98.3K
Trains

b LTN Error

4 years ago

Error while running event LogisticTrainNetwork::on_train_changed_state (ID 23)
The mod Automatic Train Painter caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Automatic_Train_Painter::Custom event (ID 217)
Automatic_Train_Painter/mod_support/LTN.lua:39: attempt to index field 'delivery' (a nil value)
stack traceback:
Automatic_Train_Painter/mod_support/LTN.lua:39: in function <Automatic_Train_Painter/mod_support/LTN.lua:38>
stack traceback:
LogisticTrainNetwork/script/train-events.lua:164: in function 'TrainLeaves'
LogisticTrainNetwork/script/train-events.lua:201: in function <LogisticTrainNetwork/script/train-events.lua:195>
stack traceback:
[C]: in function 'raise_event'
LogisticTrainNetwork/script/train-events.lua:164: in function 'TrainLeaves'
LogisticTrainNetwork/script/train-events.lua:201: in function <LogisticTrainNetwork/script/train-events.lua:195>

LTN just updated their version, now my savegame cant run with your mod anymore :(

4 years ago

I've bypassed the LTN functionality due to these unexpected changes. They're a bit deeper than they appear at first glance, with LTN completely removing the "delivery.train" field from the "on_delivery_completed" remote interface. This was a critical link between LTN and my mod's functions, so until I can determine the new way to pull the same information from LTN, this will be disabled.

4 years ago
(updated 4 years ago)

Sorry for the inconvenience. I didn't think anyone but Edurans beta for LTNT used that (redundant) data.
You can quite easily get train from train_ids:
1) track trains in a global table indexed by train_id
2) update train_id mappings from https://lua-api.factorio.com/latest/events.html#on_train_created

If you want I could also add event.train back in to reduce on_train_created overhead.

4 years ago

Hi! after teh 0.3.9 update I am getting the following error: https://imgur.com/a/EXeL0ZQ

I am posting it in here because it appears to involve LTN as well!

Let me know if you want me to try anything or think maybe one of my other mods might be causing the issue.

4 years ago

Just pushed a fix. Let me know if this bug reappears.

New response