User Tools

Site Tools


dev:core:train

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dev:core:train [2023-01-12 11:56]
ywang
dev:core:train [2023-05-24 22:57] (current)
orwell Add more fields, remove some fields that have been removed in the tss update
Line 9: Line 9:
  
 ^ Key ^ Description ^ Type ^ ^ Key ^ Description ^ Type ^
 +| ''id'' | Train ID | String |
 | ''acceleration'' | The acceleration the train is performing | Number, in m/s/s | | ''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 | | ''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 | | ''max_speed'' | The speed a train can go at | Number, in m/s |
-| ''trainparts''The carriages in a train | Table |+| ''trainparts''Table of wagon IDs of the wagons of the train | Table |
 | ''is_shunt'' | Train in shunt mode? | Boolean | | ''is_shunt'' | Train in shunt mode? | Boolean |
 | ''speed_restriction'' | The speed a train is allowed to go at | Number, in m/s | | ''speed_restriction'' | The speed a train is allowed to go at | Number, in m/s |
Line 18: Line 19:
 | ''routingcode'' | The routing code of a train | String | | ''routingcode'' | The routing code of a train | String |
 | ''line'' | The line of a train | String | | ''line'' | The line of a train | String |
 +| ''text_outside'', ''text_inside'' | Outside and inside display texts | String |
 | ''velocity'' | The speed of a train | Number, in m/s | | ''velocity'' | The speed of a train | Number, in m/s |
-| ''movedir''Direction of movement (see notes below) | Number (?) | +| ''tarvelocity''The target speed of current ATC control | Number, in m/s | 
-| ''brake''Wether brakes are enabled Boolean +| ''last_pos'' | World position of tip of train (to restore path) | Vector | 
-| ''path''table of key-co-ordinate table pairs Table +| ''last_connid'' | Connid (see [[dev:core:conns]]of last_pos pointing forward | Number 
-| ''id''Train ID String |+| ''last_frac'' | Fractional index offset from last_pos (see [[dev:core:path]]| Number 
 +| ''atc_command''Yet uninterpreted part of current ATC command String 
 +| ''autocouple''Whether train will couple on next collision Boolean 
 +| ''ars_disable''Whether ARS is disabled Boolean | 
 + 
 +Dynamic (runtime) values:
  
-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.+^ Key ^ Description ^ Type ^ 
 +| ''path'' | table of key-co-ordinate table pairs -> see path.lua | Table | 
 +| ''path_cp/cn'', ''path_dist'', ... | auxiliary tables for path -> see path.lua | Table | 
 +| ''index'' | Exact position of the front tip of the train on its ''path''. The integer part tells the index in the path table, the fractional part the offset forward towards the next path item | Number | 
 +| ''end_index'' | Calculated from ''index'', index of the rear tip of the train | Number | 
 +| ''no_step'' | If true, train skips all train steps (used for trains whose track is not found) | Boolean | 
 +| ''lever'' | The current lever value (as determined either by user control or by ATC/LZB) | Number (enum-like) | 
 +| ''ctrl_user'' | The lever input from the player (train driver) if present | Number (enum-like) | 
 +| ''lzb'' | State table of LZB subsystem (see lzb.lua) | Table |
dev/core/train.txt · Last modified: 2023-05-24 22:57 by orwell