User Tools

Site Tools


Sidebar



Minetest Forum
Content Database
Git Repository
Bug Tracker
Website

dev:core:train

This is an old revision of the document!


''train'' Table

Note Information here is incomplete. Please fill in what you know.

The train table is a table describing the state of a train. These tables are stored in the advtrains.trains table, indexed by the ID of the train. Note that IDs, despite looking like numbers, are stored as strings.

The train table is mainly seen in code where the state of the train is mutated, such as in step functions.

Some fields of the train table are shown below:

Key Description Type
acceleration The acceleration the train is performing Number, in m/s/s
drives_on A table showing which type of track the train drives on Table
max_speed The speed a train can go at Number, in m/s
trainparts The carriages in a train Table
is_shunt Train in shunt mode? Boolean
speed_restriction The speed a train is allowed to go at Number, in m/s
routingcode The routing code of a train String
line The line of a train String
velocity The speed of a train Number, in m/s
movedir Direction of movement (see notes below) Number (?)
brake Wether brakes are enabled Boolean
path table of key-co-ordinate table pairs Table
id Train ID String

Note that the movedir field is no longer set. The only reference found in the current source code suggests that the field is used to indicate the direction of the train as a binary state.

dev/core/train.1673520483.txt.gz · Last modified: 2023-01-12 11:48 by ywang