Menu
Contents

Train

$object.train:description$

Properties

active
$object.train.active:description$
blocks
$object.train.blocks:description$
emergency_stop
true if emergency stop is active, false otherwise.
id
Object id, each object has a unique id.
is_stopped
true if the train's velocity is zero, false if the train's velocity is greater than zero.
mode
$object.train.mode:description$
name
Train name
powered
true if the train contains a rail vehicle that can power the train, false otherwise.

Methods

stop

stop()

Stop the train, sets the speed to zero.

Events

on_block_assigned ≥ 0.3

Fired when the train is assigned to a block.

Handler: function (train, block, user_data)
train
The train.
block
The block the train is assigned to.
user_data
User data that was set or nil if no user data was set during connect.

on_block_entered ≥ 0.3

Fired when the train enters a block.

Handler: function (train, block, direction, user_data)
train
The train.
block
The block that is entered.
direction
Train direction from the block perspective, a Block train direction value.
user_data
User data that was set or nil if no user data was set during connect.

on_block_left ≥ 0.3

Fired when the train has left a block.

Handler: function (train, block, direction, user_data)
train
The train.
block
The block that the train left.
direction
Train direction from the block perspective, a Block train direction value.
user_data
User data that was set or nil if no user data was set during connect.

on_block_removed ≥ 0.3

Fired when the train is removed from a block.

Handler: function (train, block, user_data)
train
The train.
block
The block the train is removed from.
user_data
User data that was set or nil if no user data was set during connect.

on_block_reserved ≥ 0.3

Fired when the train reserves a block.

Handler: function (train, block, direction, user_data)
train
The train.
block
The block that is reserved by the train.
direction
Train direction from the block perspective, a Block train direction value.
user_data
User data that was set or nil if no user data was set during connect.