World
Available via from railroader import world in Main.rl and other Relay scripts.
Provides access to the game world: cars, track, switches, time, camera, and more.
Properties
Section titled “Properties”frameTime
float Current Unity frame time.
gameTime
float Time in seconds since the current game was created.
isHost
bool true if this game instance is the host (authoritative for game state). In single-player, the local machine is always the host. In multiplayer, only the server is the host.
Use this to guard logic that should only run once across all peers, such as writing shared properties in response to game events, or calling host-only APIs like placeTrain(). See Multiplayer for details and examples.
isWaiting
bool true while game time is being fast-forwarded, whether by startWaitGameHours() or by a player using the Time window. Only meaningful on the host: it is always false on clients, even while the host is waiting.
Key-Value Properties
Section titled “Key-Value Properties”objectId string Identifier of a registered key-value object, e.g. a car or industry id Returns the Properties object registered under objectId. Throws if nothing is registered under that id.
var props = world.getPropertyObject("some-car-id")props["mymod.tag"] = truelocation Location Location to search near radius float Search radius in meters Returns the car at a track location within radius meters, or null.
carTypeFilter string? AAR car type code, or null for all cars Returns a list of all cars, optionally filtered by AAR car type code.
var allCars = world.getCars(null)var boxcars = world.getCars("XM")Returns the car currently shown in the car inspector, or null.
Returns the currently selected car, or null.
car Car Car to move location Location Destination track location coupleToCar Car? Car to couple to, or null to place independently Host only. Move a car to a location.
location Location Track location to place the train at identifiers string[] Car definition identifiers, e.g. ["rr/boxcar-40ft"] Host only. Place a train at a track location. Tenders are added automatically for steam locomotives.
var loc = world.getMarkerLocation("some-marker")var cars = world.placeTrain(loc, ["rr/boxcar-40ft", "rr/boxcar-40ft"])Track & Locations
Section titled “Track & 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.
getMarkerLocation(markerId)
→ Location? markerId string Marker identifier Returns the track location for a named marker, or null if not found.
var loc = world.getMarkerLocation("yard-lead")locationByMoving(location, distance)
→ Location location Location distance float Distance to move in meters Returns a new location offset by distance meters along the track.
Switches
Section titled “Switches”getSwitchPosition(switchId)
→ Vector3 switchId string Returns the world position of a switch.
getSwitchThrown(switchId)
→ bool switchId string Returns true if the switch is in the thrown (reversed) position.
switchId string thrown bool Whether the switch should be thrown (reversed) Set a switch position.
Signals
Section titled “Signals”interlockingId string normalReversed string "N" or "R" leftRight string "L" or "R" Code a CTC route at an interlocking.
isBlockOccupied(blockId)
→ bool blockId string Returns true if a signal block is occupied.
command string Set the signal system mode.
| Value | Description |
|---|---|
"off" | Disable signals |
"abs" | Automatic Block Signaling |
"ctc" | Centralized Traffic Control |
Passenger Stops
Section titled “Passenger Stops”stationId string Returns the PassengerStop for a station. Returns null if stationId doesn’t match a known stop.
Camera & Player
Section titled “Camera & Player”getCameraPosition()
→ Vector3 Returns the current camera position.
getPlayerPosition()
→ Vector3 Returns the player’s ground position.
industryId string Move the camera to an industry.
position Vector3 Move the camera to a world position.
position Vector3 World position to face Switches to the first-person camera and smoothly rotates the player to face position.
selectedCamera()
→ string? Returns the active camera mode: "overhead", "first-person", or null.
Game State
Section titled “Game State”getBalance()
→ float Returns the current railroad account balance.
Resets the world to a clean baseline: removes all cars, un-throws switches, restores default signal mode, clears notices and waiting passengers, resets industries, and zeroes the account balance. Mainly used by test scripts to start each scenario from a clean state — not typically something a gameplay mod should call during normal play.
message string Broadcast a chat message to all players.
feature string enabled bool Enable or disable a map feature.
hours float Start fast-forwarding game time by the given number of hours, as the Time window’s wait does. Returns immediately: poll isWaiting to know when the wait has finished. Throws if a wait is already in progress. Host only.
world.startWaitGameHours(3)while world.isWaiting { yield 0.25}© 2026 Giraffe Lab LLC. All rights reserved.