Page 1 of 1

[0.12.3]on_train_changed_state messed up by signal

Posted: Tue Aug 11, 2015 9:40 pm
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

Re: [0.12.3]on_train_changed_state messed up by signal

Posted: Thu Aug 13, 2015 4:08 am
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?

Re: [0.12.3]on_train_changed_state messed up by signal

Posted: Thu Aug 13, 2015 8:44 am
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

Re: [0.12.3]on_train_changed_state messed up by signal

Posted: Fri Aug 21, 2015 7:49 am
by HanziQ
Thank you for the report, this will be fixed in the next release.