Utility object that binds to a rail entity and rail_direction to allow easier traversal over rails
LuaEntityunknownfalseRail to which this RailEnd is binding to.
defines.rail_directionunknownfalseWhich end of the rail this RailEnd is binding to.
RailLocationunknownfalseLocation of the rail end
RailLocationunknownfalseLocation of an outgoing signal, which goes to the right relative to the rail end movement.
RailLocationunknowntrueLocation of the alternative outgoing signal, which goes to the right relative to the rail end movement. Not all places have alternative outgoing signal spot, so when it is not available, a nil will be given instead
RailLocationunknownfalseLocation of an incoming signal, which goes to the left relative to the rail end movement.
RailLocationunknowntrueLocation of the alternative incoming signal, which goes to the right relative to the rail end movement. Not all places have alternative incoming signal spot, so when it is not available, a nil will be given instead
booleanunknownfalseIs 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.
stringunknownfalseThe 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.
LuaRailEnd.make_copy() -> LuaRailEnd
railEnd.make_copy()
takes_table: falsetable_optional: falseCreates a copy of this LuaRailEnd object.
LuaRailEndLuaRailEnd.flip_direction()
railEnd.flip_direction()
takes_table: falsetable_optional: falseMoves to opposite end on the rail this object points to
LuaRailEnd.move_forward(connection_direction: defines.rail_connection_direction) -> boolean
railEnd.move_forward(connection_direction)
takes_table: falsetable_optional: falseMoves forward by 1 rail to the specified connection direction
connection_direction: defines.rail_connection_directionboolean — If the move was successful. False if there is no rail connected in given connection_directionLuaRailEnd.move_natural() -> boolean
railEnd.move_natural()
takes_table: falsetable_optional: falseMoves forward by 1 rail in the natural direction. Natural direction is a move in the direction taken by the train over rail connection related to this rail end. If there are no trains, the natural direction is straight if straight connected rail exists, otherwise it is right if right connected rail exists, otherwise it is left if left connected rail exists. Natural direction is not defined if there are no rails connected to this end and this method will fail.
boolean — If the move was successful. False only when there are no rails connected on this endLuaRailEnd.move_to_segment_end()
railEnd.move_to_segment_end()
takes_table: falsetable_optional: falseMoves forward until a rail segment boundary is reached. If this rail end is at the segment boundary, it will not move at all. When a rail segment is cyclical, it will reach the rail segment boundary at some arbitrary position unless the segment boundary is well defined by presence of rail signals, train stop or other rails connecting to the rails loop.
LuaRailEnd.get_rail_extensions(planner_item: ItemID) -> Array<RailExtensionData>
railEnd.get_rail_extensions(planner_item)
takes_table: falsetable_optional: falseReturns all possible rail extensions from this position as defined by the planner item.
planner_item: ItemID — Rail planner that defines possible rail extensionsArray<RailExtensionData>