Automatic Train Painter


Automatically colors locomotives and wagons based on their contents.

Tweaks
11 months ago
0.17 - 1.1
79.6K
Trains

g 0.3.9 Error

4 years ago

Got this error message after the update today:

Error while running event Automatic_Train_Painter::on_train_changed_state (ID 23)
Automatic_Train_Painter/mod_support/LTN.lua:31: attempt to index field 'deliveries' (a nil value)
stack traceback:
Automatic_Train_Painter/mod_support/LTN.lua:31: in function 'LTN_check'
Automatic_Train_Painter/control.lua:22: in function <Automatic_Train_Painter/control.lua:11>

4 years ago

Hmmm, this error didn't come up during my playtesting. I need a minute to check it out.

4 years ago

Do you have LTN enabled? I found a critical oversight that would definitely crash the mod if not. I'll release a patch for that once I verify that would solve this particular bug.

4 years ago

I don't have LTN enabled. The crash occurred right when the train was trying to leave the station. Empty I believe.

4 years ago

That would explain it. Hope it's fixed now!

4 years ago

Thanks! I'll try it out and let you know if it doesn't work.

4 years ago
(updated 4 years ago)

Nope, not fixed. Using LTN (no LTN stations yet). It crashes in multiplayer when host player enters a train and goes to a scheduled station.

4637.801 Error MainLoop.cpp:1202: Exception at tick 2481034: Мод Automatic Train Painter (0.3.10) Π²Ρ‹Π·Π²Π°Π» Π½Π΅ΡƒΡΡ‚Ρ€Π°Π½ΠΈΠΌΡƒΡŽ ΠΎΡˆΠΈΠ±ΠΊΡƒ.
ΠŸΠΎΠΆΠ°Π»ΡƒΠΉΡΡ‚Π°, сообщитС ΠΎΠ± этой ошибкС Π°Π²Ρ‚ΠΎΡ€Ρƒ ΠΌΠΎΠ΄Π°.

Error while running event Automatic_Train_Painter::on_train_changed_state (ID 23)
Automatic_Train_Painter/mod_support/LTN.lua:31: attempt to index field 'deliveries' (a nil value)
stack traceback:
Automatic_Train_Painter/mod_support/LTN.lua:31: in function 'LTN_check'
Automatic_Train_Painter/control.lua:23: in function <Automatic_Train_Painter/control.lua:11>

4 years ago

Same here, 0.3.10 crashes with above error. I do have a big LTN network with many stations. This is in singleplayer.

4 years ago

I was able to get a crash when LTN is enabled and no LTN stations have yet been built. Specifically, when a train changes state and the LTN dispatcher has not updated for the first time. I should be able to fix that relatively quickly. As far as I can tell, LTN dispatcher will update at most 60 ticks after the first LTN station is placed, so if LTN is already established, this might be a case of bad timing. I'll see if I can reproduce that bug.

3 years ago
(updated 3 years ago)

Hi,
I have just found another (or the same?) LTN related issue.
Version: Automatic_Train_Painter_0.3.11, Factorio (Latest Experimental = .22)

after switching factorio from .21 to .22 my map immediately crashed when i connect to the deadicated server:
Main Mods: Space Exploration (= Multi Surface game) , Krastorio 2 ( probably unrelated), LTN, LTN Manager (Alpha)
No issues prior to .22
Medium Network size like 50 Stations ...
Thanks for looking into the issue, if you need more details feel free to request more details.

 149.748 Info ServerSynchronizer.cpp:599: nextHeartbeatSequenceNumber(2536) adding peer(1)
 149.765 Info ServerMultiplayerManager.cpp:771: updateTick(29606887) changing state from(InGame) to(InGameSavingMap)
 149.799 Info ServerMultiplayerManager.cpp:919: updateTick(29606887) received stateChanged peerID(1) oldState(Ready) newState(ConnectedWaitingForMap)
 158.398 Info ServerMultiplayerManager.cpp:986: UpdateTick(29606887) Serving map(/opt/factorio/temp/mp-save-0.zip) for peer(1) size(66261194) crc(1909266522)
 158.398 Info ServerMultiplayerManager.cpp:771: updateTick(29606887) changing state from(InGameSavingMap) to(InGame)
 158.482 Info ServerMultiplayerManager.cpp:919: updateTick(29606887) received stateChanged peerID(1) oldState(ConnectedWaitingForMap) newState(ConnectedDownloadingMap)
 168.585 Info ServerMultiplayerManager.cpp:919: updateTick(29606887) received stateChanged peerID(1) oldState(ConnectedDownloadingMap) newState(ConnectedLoadingMap)
 172.170 Error MainLoop.cpp:1202: Exception at tick 29607036: The mod LTN - Logistic Train Network (1.13.1) caused a non-recoverable error. Please report this error to the mod author.
Error while running event LogisticTrainNetwork::on_train_changed_state (ID 23)
The mod Automatic Train Painter (0.3.11) caused a non-recoverable error. Please report this error to the mod author.
Error while running event Automatic_Train_Painter::Custom event (ID 200)
__Automatic_Train_Painter__/mod_support/LTN.lua:81: attempt to index field 'painted_ltn_trains' (a nil value)
stack traceback:
        __Automatic_Train_Painter__/mod_support/LTN.lua:81: in function 'LTN_unpaint'
        __Automatic_Train_Painter__/mod_support/LTN.lua:24: in function <__Automatic_Train_Painter__/mod_support/LTN.lua:23>
stack traceback:
        __LogisticTrainNetwork__/script/train-events.lua:157: in function 'TrainLeaves'
        __LogisticTrainNetwork__/script/train-events.lua:194: in function <__LogisticTrainNetwork__/script/train-events.lua:188>
stack traceback:
        [C]: in function 'raise_event'
        __LogisticTrainNetwork__/script/train-events.lua:157: in function 'TrainLeaves'
        __LogisticTrainNetwork__/script/train-events.lua:194: in function <__LogisticTrainNetwork__/script/train-events.lua:188>
 172.171 Error ServerMultiplayerManager.cpp:90: MultiplayerManager failed: "The mod LTN - Logistic Train Network (1.13.1) caused a non-recoverable error. Please report this error to the mod author.
Error while running event LogisticTrainNetwork::on_train_changed_state (ID 23)
The mod Automatic Train Painter (0.3.11) caused a non-recoverable error. Please report this error to the mod author.
Error while running event Automatic_Train_Painter::Custom event (ID 200)
__Automatic_Train_Painter__/mod_support/LTN.lua:81: attempt to index field 'painted_ltn_trains' (a nil value)
stack traceback:
        __Automatic_Train_Painter__/mod_support/LTN.lua:81: in function 'LTN_unpaint'
        __Automatic_Train_Painter__/mod_support/LTN.lua:24: in function <__Automatic_Train_Painter__/mod_support/LTN.lua:23>
stack traceback:
        __LogisticTrainNetwork__/script/train-events.lua:157: in function 'TrainLeaves'
        __LogisticTrainNetwork__/script/train-events.lua:194: in function <__LogisticTrainNetwork__/script/train-events.lua:188>
stack traceback:
        [C]: in function 'raise_event'
        __LogisticTrainNetwork__/script/train-events.lua:157: in function 'TrainLeaves'
        __LogisticTrainNetwork__/script/train-events.lua:194: in function <__LogisticTrainNetwork__/script/train-events.lua:188>"
 172.171 Info ServerMultiplayerManager.cpp:771: updateTick(29607036) changing state from(InGame) to(Failed)
 172.171 Quitting: multiplayer error.
3 years ago

It looks like the game starts in the middle of an LTN sequence, where one of the crucial variables in the chain had not yet been defined. Given the specificity of the timing for this have occurred, I have been unable reproduce this crash, but I have an idea for a fix.

New response