get_item_count(item) → uint | Get the amount of a particular item stored in the train. |
get_contents() → dictionary string → uint | Get a mapping of the train's inventory. |
remove_item(stack) → uint | Remove some items from the train. |
insert(stack) | Insert a stack into the train. |
clear_items_inside() | Clear all items in this train. |
recalculate_path(force) → boolean | Checks if the path is invalid and tries to re-path if it isn't. |
get_fluid_count(fluid) → double | Get the amount of a particular fluid stored in the train. |
get_fluid_contents() → dictionary string → double | Gets a mapping of the train's fluid inventory. |
remove_fluid(fluid) → double | Remove some fluid from the train. |
insert_fluid(fluid) → double | Inserts the given fluid into the first available location in this train. |
clear_fluids_inside() | Clears all fluids in this train. |
manual_mode :: boolean [RW] | When true , the train is explicitly controlled by the player or script. |
speed :: double [RW] | Current speed. |
carriages :: array of LuaEntity [R] | Rolling stocks the train is composed of. |
locomotives :: dictionary string → array of LuaEntity [R] | Arrays of locomotives. |
cargo_wagons :: array of LuaEntity [R] | The cargo carriages the train contains. |
fluid_wagons :: array of LuaEntity [R] | The fluid carriages the train contains. |
schedule :: TrainSchedule [RW] | |
state :: defines.train_state [R] | This train's current state. |
front_rail :: LuaEntity [R] | The rail at the front end of the train, possibly nil . |
back_rail :: LuaEntity [R] | The rail at the back end of the train, possibly nil . |
rail_direction_from_front_rail :: defines.rail_direction [R] | |
rail_direction_from_back_rail :: defines.rail_direction [R] | |
front_stock :: LuaEntity [R] | The front stock of this train or nil . |
back_stock :: LuaEntity [R] | The back stock of this train or nil . |
station :: LuaEntity [R] | The train stop this train is stopped at or nil . |
has_path :: boolean [R] | If this train has a path. |
path_end_rail :: LuaEntity [R] | The destination rail this train is currently pathing to or nil . |
path_end_stop :: LuaEntity [R] | The destination train stop this train is currently pathing to or nil . |
id :: uint [R] | The unique train ID. |
valid :: boolean [R] | Is this object valid? |
help() → string | All methods, and properties that this object supports. |
A train. Trains are a sequence of connected rolling stocks -- locomotives and wagons.
Get the amount of a particular item stored in the train.
Get a mapping of the train's inventory.
Remove some items from the train.
Clear all items in this train.
Checks if the path is invalid and tries to re-path if it isn't.
Get the amount of a particular fluid stored in the train.
Gets a mapping of the train's fluid inventory.
Remove some fluid from the train.
Inserts the given fluid into the first available location in this train.
Clears all fluids in this train.
When true
, the train is explicitly controlled by the player or script. When false
, the
train moves autonomously according to its schedule.
Current speed.
Rolling stocks the train is composed of.
Arrays of locomotives. The result is two arrays, indexed by "front_movers"
and "back_movers"
containing the locomotives. E.g. {front_movers={loco1, loco2}, back_movers={loco3}}
.
The cargo carriages the train contains.
The fluid carriages the train contains.
This train's current state.
The rail at the front end of the train, possibly nil
.
The rail at the back end of the train, possibly nil
.
The front stock of this train or nil
.
The back stock of this train or nil
.
The train stop this train is stopped at or nil
.
If this train has a path.
The destination rail this train is currently pathing to or nil
.
The destination train stop this train is currently pathing to or nil
.
The unique train ID.