mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-09 00:08:04 -06:00
247 lines
11 KiB
Lua
247 lines
11 KiB
Lua
---@meta
|
|
---@diagnostic disable
|
|
|
|
--$Factorio 1.1.72
|
|
--$Overlay 5
|
|
--$Section LuaTrain
|
|
-- This file is automatically generated. Edits will be overwritten.
|
|
|
|
---A train. Trains are a sequence of connected rolling stocks -- locomotives and wagons.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html)
|
|
---@class LuaTrain:LuaObject
|
|
---[R]
|
|
---The rail at the back end of the train, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.back_rail)
|
|
---@field back_rail? LuaEntity
|
|
---[R]
|
|
---The back stock of this train, if any. The back of the train is at the opposite end of the [front](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.front_stock).
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.back_stock)
|
|
---@field back_stock? LuaEntity
|
|
---[R]
|
|
---The cargo carriages the train contains.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.cargo_wagons)
|
|
---@field cargo_wagons LuaEntity[]
|
|
---[R]
|
|
---The rolling stocks this train is composed of, with the numbering starting at the [front](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.front_stock) of the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.carriages)
|
|
---@field carriages LuaEntity[]
|
|
---[R]
|
|
---The fluid carriages the train contains.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.fluid_wagons)
|
|
---@field fluid_wagons LuaEntity[]
|
|
---[R]
|
|
---The rail at the front end of the train, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.front_rail)
|
|
---@field front_rail? LuaEntity
|
|
---[R]
|
|
---The front stock of this train, if any. The front of the train is in the direction that a majority of locomotives are pointing in. If it's a tie, the North and West directions take precedence.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.front_stock)
|
|
---@field front_stock? LuaEntity
|
|
---[R]
|
|
---If this train has a path.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.has_path)
|
|
---@field has_path boolean
|
|
---[R]
|
|
---The unique train ID.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.id)
|
|
---@field id uint
|
|
---[R]
|
|
---The total number of kills by this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.kill_count)
|
|
---@field kill_count uint
|
|
---[R]
|
|
---The players killed by this train.
|
|
---
|
|
---The keys are the player indices, the values are how often this train killed that player.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.killed_players)
|
|
---@field killed_players {[uint]: uint}
|
|
---[R]
|
|
---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}}`.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.locomotives)
|
|
---@field locomotives {[string]: LuaEntity[]}
|
|
---[RW]
|
|
---When `true`, the train is explicitly controlled by the player or script. When `false`, the train moves autonomously according to its schedule.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.manual_mode)
|
|
---@field manual_mode boolean
|
|
---[R]
|
|
---Current max speed when moving backwards, depends on locomotive prototype and fuel.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.max_backward_speed)
|
|
---@field max_backward_speed double
|
|
---[R]
|
|
---Current max speed when moving forward, depends on locomotive prototype and fuel.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.max_forward_speed)
|
|
---@field max_forward_speed double
|
|
---[R]
|
|
---The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.object_name)
|
|
---@field object_name string
|
|
---[R]
|
|
---The player passengers on the train
|
|
---
|
|
---**Note:** This does *not* index using player index. See [LuaPlayer::index](https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.index) on each player instance for the player index.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.passengers)
|
|
---@field passengers LuaPlayer[]
|
|
---[R]
|
|
---The path this train is using, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.path)
|
|
---@field path? LuaRailPath
|
|
---[R]
|
|
---The destination rail this train is currently pathing to, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.path_end_rail)
|
|
---@field path_end_rail? LuaEntity
|
|
---[R]
|
|
---The destination train stop this train is currently pathing to, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.path_end_stop)
|
|
---@field path_end_stop? LuaEntity
|
|
---[R]
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.rail_direction_from_back_rail)
|
|
---@field rail_direction_from_back_rail defines.rail_direction
|
|
---[R]
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.rail_direction_from_front_rail)
|
|
---@field rail_direction_from_front_rail defines.rail_direction
|
|
---[R]
|
|
---The riding state of this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.riding_state)
|
|
---@field riding_state RidingState
|
|
---[RW]
|
|
---This train's current schedule, if any. Set to `nil` to clear.
|
|
---
|
|
---**Note:** The schedule can't be changed by modifying the returned table. Instead, changes must be made by assigning a new table to this attribute.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.schedule)
|
|
---@field schedule? TrainSchedule
|
|
---[R]
|
|
---The signal this train is arriving or waiting at, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.signal)
|
|
---@field signal? LuaEntity
|
|
---[RW]
|
|
---Current speed.
|
|
---
|
|
---**Note:** Changing the speed of the train is potentially an unsafe operation because train uses the speed for its internal calculations of break distances, etc.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.speed)
|
|
---@field speed double
|
|
---[R]
|
|
---This train's current state.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.state)
|
|
---@field state defines.train_state
|
|
---[R]
|
|
---The train stop this train is stopped at, if any.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.station)
|
|
---@field station? LuaEntity
|
|
---[R]
|
|
---Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.valid)
|
|
---@field valid boolean
|
|
---[R]
|
|
---The weight of this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.weight)
|
|
---@field weight double
|
|
local LuaTrain={
|
|
---Clears all fluids in this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.clear_fluids_inside)
|
|
clear_fluids_inside=function()end,
|
|
---Clear all items in this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.clear_items_inside)
|
|
clear_items_inside=function()end,
|
|
---Get a mapping of the train's inventory.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_contents)
|
|
---@return {[string]: uint}@The counts, indexed by item names.
|
|
get_contents=function()end,
|
|
---Gets a mapping of the train's fluid inventory.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_fluid_contents)
|
|
---@return {[string]: double}@The counts, indexed by fluid names.
|
|
get_fluid_contents=function()end,
|
|
---Get the amount of a particular fluid stored in the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_fluid_count)
|
|
---@param fluid string?@Fluid name to count. If not given, counts all fluids.
|
|
---@return double
|
|
get_fluid_count=function(fluid)end,
|
|
---Get the amount of a particular item stored in the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_item_count)
|
|
---@param item string?@Item name to count. If not given, counts all items.
|
|
---@return uint
|
|
get_item_count=function(item)end,
|
|
---Gets all rails under the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.get_rails)
|
|
---@return LuaEntity[]
|
|
get_rails=function()end,
|
|
---Go to the station specified by the index in the train's schedule.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.go_to_station)
|
|
---@param index uint
|
|
go_to_station=function(index)end,
|
|
---All methods and properties that this object supports.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.help)
|
|
---@return string
|
|
help=function()end,
|
|
---Insert a stack into the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.insert)
|
|
---@param stack ItemStackIdentification
|
|
insert=function(stack)end,
|
|
---Inserts the given fluid into the first available location in this train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.insert_fluid)
|
|
---@param fluid Fluid
|
|
---@return double@The amount inserted.
|
|
insert_fluid=function(fluid)end,
|
|
---Checks if the path is invalid and tries to re-path if it isn't.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path)
|
|
---@param force boolean?@Forces the train to re-path regardless of the current path being valid or not.
|
|
---@return boolean@If the train has a path after the repath attempt.
|
|
recalculate_path=function(force)end,
|
|
---Remove some fluid from the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.remove_fluid)
|
|
---@param fluid Fluid
|
|
---@return double@The amount of fluid actually removed.
|
|
remove_fluid=function(fluid)end,
|
|
---Remove some items from the train.
|
|
---
|
|
---[View documentation](https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.remove_item)
|
|
---@param stack ItemStackIdentification@The amount and type of items to remove
|
|
---@return uint@Number of items actually removed.
|
|
remove_item=function(stack)end,
|
|
}
|
|
|
|
|