Track
The track module (reached via world.track) exposes the track graph: segments, switches, and queries over Locations.
from railroader import world
var loc = world.track.getMarkerLocation("yard-lead")var ahead = world.track.locationByMoving(loc, 100.0, false, false)Locations
Section titled “Locations”locationA Location locationB Location limit float Maximum distance in meters Returns true if two locations are on the same route within limit meters.
locationA Location locationB Location Returns the track distance in meters between two locations. If no route connects them, logs a warning and falls back to an approximation: exact when both locations are on the same segment, otherwise the straight-line distance between them.
markerId string Marker identifier Returns the track location for a named marker, or null if not found.
var loc = world.track.getMarkerLocation("yard-lead")location Location distance float Distance to move in meters checkSwitchAgainst bool = false stopEndOfTrack bool = false Returns a new location offset by distance meters along the track.
Segments
Section titled “Segments”segmentId string Returns the segment with the given identifier, or null if there is none.
var posted = world.track.getSegment("jmi303")?.postedClassSwitches
Section titled “Switches”getSwitchPosition(switchId)
→ Vector3 switchId string Returns the world position of a switch. Throws if the switch isn’t found.
getSwitchThrown(switchId)
→ bool switchId string Returns true if the switch is in the thrown (reversed) position. Throws if the switch isn’t found.
switchId string thrown bool Whether the switch should be thrown (reversed) Host only. Sets a switch position. Throws on a client, and on the host if the switch can’t be set, for example when a car is on it or it is CTC controlled and locked.
TrackSegment
Section titled “TrackSegment”A segment of track, returned by getSegment(). Properties read live on each access.
condition
float Current track condition, from 0 (ruined) to 1 (perfect).
id
string The segment identifier.
length
float Length of the segment in meters.
postedClass
int The posted track class, 1 to 5, which sets the speed limit and tie paint. It lags the actual condition: it is updated on an inspection cadence and when the segment becomes unoccupied, and a downgrade is never posted under a train.
condition float 0 (ruined) to 1 (perfect); values outside are clamped Host only. Sets the segment’s condition directly and marks the segment as maintained now, which also resets vegetation overgrowth. Throws on a client.
© 2026 Giraffe Lab LLC. All rights reserved.