Automatic Station Painter


Automagically colors stations based on the trains' colors.

Content
29 days ago
1.1 - 2.0
17.9K
Logistics

b Crash when renaming a station while train is en route

4 years ago

This is a fun way to keep your stations colored, thanks for the mod! Found a small issue:

Error while running event automatic-station-painter::on_train_changed_state (ID 23)
automatic-station-painter/control.lua:59: attempt to index field 'station' (a nil value)
stack traceback:
automatic-station-painter/control.lua:59: in function <automatic-station-painter/control.lua:33>

Using ATP and LTN (though not sure LTN matters). My approximate repro steps are:

  1. Train is dispatched to station by LTN.
  2. Destination station is renamed while train is en route
  3. Crash will occur as the train arrives at the now renamed station
4 years ago
(updated 4 years ago)

Thanks for the report. I was not able to reproduce it. My attempt was:

  1. Open the train's schedule and press > on the next stop;
  2. Open the next stop station and change the name;
  3. Wait for the train to arrive; and
  4. Everything is puppies and rainbows.

This may be a bug in the Factorio API since the event that indicates the train arrived at a station didn't have the station in the train's data structure. Regardless, I've guarded against this case now and hopefully it'll resolve your problem.

4 years ago

maybe a related bug, or something completely different ...

mods used: many, including LTN, Automatic Train Painter, Automatic Station Painter and also Wagon Auto Graphics.
edit: same problem persisted after removing Wagon Auto Graphics

i just installed this mod and updated all mods and all went well until LTN sent some train from a depot. immediately thereafter (i did NOT change any names at this point) the game crashed with the following message. thus i assume it was related to trying to color the depot itself !?

The mod Automatic Station Painter (1.0.1) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event automatic-station-painter::on_train_changed_state (ID 23)
automatic-station-painter/control.lua:81: attempt to index local 'c2' (a nil value)
stack traceback:
automatic-station-painter/control.lua:81: in function 'blend_colors'
automatic-station-painter/control.lua:125: in function 'paint_station'
automatic-station-painter/control.lua:64: in function <automatic-station-painter/control.lua:33>

4 years ago
(updated 4 years ago)

Thank you for the report. I have identified the problem and will be releasing the fix today.

New response