[0.12.3]on_train_changed_state messed up by signal

This subforum contains all the issues which we already resolved.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

[0.12.3]on_train_changed_state messed up by signal

Post by Choumiko »

Image

It seems like the signal messes with the trains state. In the image you can see on the path -> arrive station -> on the path -> wait station (@mm:ss:tt)
From my understanding for a schedule with 2 stations and no red signals between it should only ever change from wait station -> on the path -> arrive station -> etc.
If you remove the signal in the attached save it works as expected.
Attached mod is simply printing the state along with the tick
Attachments
SmartTrains_0.3.61.zip
(1.06 KiB) Downloaded 196 times
signalState.zip
(1.91 MiB) Downloaded 188 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 14152
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.3]on_train_changed_state messed up by signal

Post by Rseding91 »

Have you tested to make sure it's not simply skipping printing due to repetitive text? Pre-append an incrementing number that's incremented each time it prints to the output and see what gets printed.

Also, what do you expect it to do vs what is it appearing to do now?
If you want to get ahold of me I'm almost always on Discord.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.3]on_train_changed_state messed up by signal

Post by Choumiko »

Rseding91 wrote:Have you tested to make sure it's not simply skipping printing due to repetitive text? Pre-append an incrementing number that's incremented each time it prints to the output and see what gets printed.

Code: Select all

debugDump(util.formattime(event.tick,true).." "..getKeyByValue(defines.trainstate, event.train.state),true)
formattime returns the tick as mm:ss:tick, should be enough?
Rseding91 wrote:Also, what do you expect it to do vs what is it appearing to do now?
I played with it some more, now i'm not sure if it's a bug or only a case of me misinterpreting the keys in defines.trainstate
What i think they are:
  • on_the_path: Train accellerates or runs at max speed
  • arrive_station: Train starts breaking before it reaches the station
  • wait_station: train is stopped at a station
So i expect the trains state going from: wait station - on the path - arrive station - wait station - on the path - arrive station - and so on (assuming no signal is red etc) (this is how it actually is if the signal is removed)

I found out today that after the first state change from on_the_path to arrive_station every signal that get's reserved (set to yellow) by the train, causes the state to change to on_the_path and after 1 tick back to arrive_station. That's what is confusing me. Could be because the pathfinder does something when a signal gets reserved.
It's really a non issue, very very minor thing, but it's sort of an unexpected behaviour. (In SmartTrains i'm already setting a state called left_station when the state changes from wait station to on the path, if the behaviour becomes an issue i'd probably do something similiar and group the unexpected changes into a state like reserved_signal)

Hope you get what i mean. To be honest i think it's not even worth being looked at unless you're really really bored :D

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: [0.12.3]on_train_changed_state messed up by signal

Post by HanziQ »

Thank you for the report, this will be fixed in the next release.

Post Reply

Return to “Resolved Problems and Bugs”