Page 1 of 1

[aaargha] [0.16.2]Scripting train schedule can cause overshoot

Posted: Thu Dec 14, 2017 8:43 pm
by aaargha
Changing the destination via scripts while a train is in arrive_station can cause it to not properly stop at the next stop, instead it overshoots and gets stuck on no path just past the train stop.

To reproduce in the save below:
1. Set the train to auto
2. Run this script when it has passed the hazard concrete while on the path to the south stop

Code: Select all

/c local train = game.player.force.get_trains(1)[1]
local schedule = table.deepcopy(train.schedule)
schedule.current = 1
train.schedule = schedule
3. the train should get stuck on the north station

Re: [0.16.2]Scripting train schedule can cause overshoot

Posted: Thu Dec 14, 2017 8:45 pm
by Rseding91
Thanks for the report however this is working correctly. If the schedule is changed such that the train can't stop in time it's going to over-shoot its destination. If you don't want it to do that you'll need to adjust the train speed to a low enough value that it can stop in time or don't change train schedules on moving trains.

Re: [0.16.2]Scripting train schedule can cause overshoot

Posted: Thu Dec 14, 2017 8:49 pm
by aaargha
The train stop it's switching to is far away giving the train ample time to stop if it wanted to. It's not that it can't it's that it does not attempt to.

EDIT: in fact the train does not change speed at all after changing the schedule. It just coasts along at the same speed until it has passed the train stop at which point it goes into no path (on a loop as well)

Re: [Rseding91] [0.16.2]Scripting train schedule can cause overshoot

Posted: Thu Dec 28, 2017 8:57 pm
by kovarex
I'm moving it to resolved for next release. Fixed by aaargha himself :)
Thank you.