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

This subforum contains all the issues which we already resolved.
Post Reply
aaargha
Filter Inserter
Filter Inserter
Posts: 330
Joined: Wed Dec 07, 2016 8:35 am
Contact:

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

Post 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
Attachments
Schedule change bug.zip
(2.14 MiB) Downloaded 27 times

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

Re: [0.16.2]Scripting train schedule can cause overshoot

Post 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.
If you want to get ahold of me I'm almost always on Discord.

aaargha
Filter Inserter
Filter Inserter
Posts: 330
Joined: Wed Dec 07, 2016 8:35 am
Contact:

Re: [0.16.2]Scripting train schedule can cause overshoot

Post 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)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

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

Post by kovarex »

I'm moving it to resolved for next release. Fixed by aaargha himself :)
Thank you.

Post Reply

Return to “Resolved Problems and Bugs”