pub struct LuaRailEnd;Expand description
Utility object that binds to a rail entity and rail_direction to allow easier traversal over rails
Implementations§
Source§impl LuaRailEnd
impl LuaRailEnd
Sourcepub fn alternative_in_signal_location(&self) -> RailLocation
pub fn alternative_in_signal_location(&self) -> RailLocation
Location 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
Sourcepub fn alternative_out_signal_location(&self) -> RailLocation
pub fn alternative_out_signal_location(&self) -> RailLocation
Location 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
Sourcepub fn in_signal_location(&self) -> RailLocation
pub fn in_signal_location(&self) -> RailLocation
Location of an incoming signal, which goes to the left relative to the rail end movement.
Sourcepub fn location(&self) -> RailLocation
pub fn location(&self) -> RailLocation
Location of the rail end
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
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.
Sourcepub fn out_signal_location(&self) -> RailLocation
pub fn out_signal_location(&self) -> RailLocation
Location of an outgoing signal, which goes to the right relative to the rail end movement.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
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.
Sourcepub fn flip_direction(&self)
pub fn flip_direction(&self)
Moves to opposite end on the rail this object points to
Sourcepub fn get_rail_extensions(
&self,
planner_item: LuaAny,
) -> Vec<RailExtensionData>
pub fn get_rail_extensions( &self, planner_item: LuaAny, ) -> Vec<RailExtensionData>
Returns all possible rail extensions from this position as defined by the planner item.
Sourcepub fn make_copy(&self) -> LuaRailEnd
pub fn make_copy(&self) -> LuaRailEnd
Creates a copy of this LuaRailEnd object.
Sourcepub fn move_forward(&self, connection_direction: &str) -> bool
pub fn move_forward(&self, connection_direction: &str) -> bool
Moves forward by 1 rail to the specified connection direction
Sourcepub fn move_natural(&self) -> bool
pub fn move_natural(&self) -> bool
Moves 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.
Sourcepub fn move_to_segment_end(&self)
pub fn move_to_segment_end(&self)
Moves 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.
Trait Implementations§
Source§impl Clone for LuaRailEnd
impl Clone for LuaRailEnd
Source§fn clone(&self) -> LuaRailEnd
fn clone(&self) -> LuaRailEnd
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more