The train limit of a train stop that is part of the train's schedule becomes not full.A train stop that is part of the train's schedule gets enabled, renamed or created.The train is pathing to a train stop that gets disabled.The train wants to depart from a train stop.The train wants to depart from a signal (chain or regular) that it stopped at.The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination.The train enters a new rail block and can't reserve the next needed signal (chain or regular).The train is braking for a signal (chain or regular) it cant reserve.The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue.The train stop a train is heading to is renamed or destroyed.Repaths that happen as part of normal train operation A waypoint (train stop without wait condition) is removed from the train's schedule.The train is set to go to a station using the "Go to stop" button in the train's GUI.The train is switched to automatic control when it was previously manually controlled.LuaTrain::recalculate_path(true) is called on the train by a script.A locomotive that is part of the train is rotated.When one of these conditions is met the game considers possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. There are a number of events that can cause a train to repath listed below. The train has waited at a chain signal for a multiple of 5 seconds.The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.LuaTrain::recalculate_path() is called on the train by a script.A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated).A signal (chain or regular) is created or destroyed (all trains are revalidated).A rail is created and invalidates a signal (all trains are revalidated).A rail is destroyed (all trains are revalidated).
The following events cause path revalidation: Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. If the path is found to be invalid then the game will repath the train.
Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).The cost (distance) is calculated using the following weighting rules: A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). 3.2 Repaths that happen as part of normal train operationįor calculation it uses a simple A*-algorithm : The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments.