Block rail tile
Represents a block in the train control system. A block is a section of track that can detect, reserve, and track trains.
Properties
id
Unique object identifier. Each object in Traintastic has a globally unique id that can be used in scripts (see world.get_object).
name
The name assigned to the block, used for the user interface.
state
The current state of the block, a block state value. Indicates whether the block is free, reserved, occupied, or its state is unknown.
trains
List of train block status objects with information about the trains in this block.
Events
on_train_assigned
Fired when a train is manually assigned to the block. This happens after a train has been placed on the track and the operator links it to the block, allowing Traintastic to recognize which train it is.
This event is about train identification, not movement.
Handler signature
function (train, block, user_data)
Arguments
-
train- Train that is assigned to the block. -
block- The block that the train is assigned to. -
user_data- optional user-provided value (see Events).
on_train_entered
Fired when a Train enters the block.
Handler signature
function (train, block, direction, user_data)
Arguments
-
train- Train that entered the block. -
block- The block that is entered. -
direction- Train direction from the block perspective, a Block train direction value. -
user_data- optional user-provided value (see Events).
on_train_left
Fired when a Train has left the block.
Handler signature
function (train, block, direction, user_data)
Arguments
-
train- Train that entered the block. -
block- The block that the train left. -
direction- Train direction from the block perspective, a Block train direction value. -
user_data- optional user-provided value (see Events).
on_train_removed
Fired when a train is manually removed from the block. This is the opposite of on_train_assigned and indicates the train is no longer linked to the block.
This event is about train identification, not movement.
Handler signature
function (train, block, user_data)
Arguments
-
train- Train that is removed from the block. -
block- The block that the train is removed from. -
user_data- optional user-provided value (see Events).
on_train_reserved
Fired when a Train reserves the block.
Handler signature
function (train, block, direction, user_data)
Arguments
-
train- Train that is reserved the block. -
block- The block that is reserved. -
direction- Train direction from the block perspective, a Block train direction value. -
user_data- optional user-provided value (see Events).