Skip to main content

LuaTransportLine

Struct LuaTransportLine 

Source
pub struct LuaTransportLine;
Expand description

One line on a transport belt.

Implementations§

Source§

impl LuaTransportLine

Source

pub fn input_lines(&self) -> Vec<LuaTransportLine>

The transport lines that this transport line is fed by or an empty table if none.

Source

pub fn line_length(&self) -> f32

Length of the transport line. Items can be inserted at line position from 0 up to returned value

Source

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.

Source

pub fn output_lines(&self) -> Vec<LuaTransportLine>

The transport lines that this transport line outputs items to or an empty table if none.

Source

pub fn owner(&self) -> LuaEntity

The entity this transport line belongs to.

Source

pub fn total_segment_length(&self) -> f64

Total length of segment which consists of this line, all lines in front and lines in the back directly connected.

Source

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.

Source

pub fn can_insert_at(&self, position: f32) -> bool

Can an item be inserted at a given position?

Source

pub fn can_insert_at_back(&self) -> bool

Can an item be inserted at the back of this line?

Source

pub fn clear(&self)

Remove all items from this transport line.

Source

pub fn force_insert_at( &self, belt_stack_size: Option<u8>, items: LuaAny, position: f32, )

Force insert item at a given position. Inserts item onto a transport line. If a position is out of range, it is clamped to a closest valid position on the transport line. Item will be inserted regardless of other items nearby, possibly forcing items to become squashed.

Source

pub fn get_contents(&self) -> Vec<ItemWithQualityCount>

Get counts of all items on this line, similar to how LuaInventory::get_contents does.

Source

pub fn get_detailed_contents(&self) -> Vec<DetailedItemOnLine>

Get detailed information of items on this line, such as their position.

Source

pub fn get_item_count(&self, item: Option<ItemFilter>) -> u32

Count some or all items on this line, similar to how LuaInventory::get_item_count does.

Source

pub fn get_line_item_position(&self, position: f32) -> MapPosition

Get a map position related to a position on a transport line.

Source

pub fn insert_at( &self, belt_stack_size: Option<u8>, items: LuaAny, position: f32, ) -> bool

Insert items at a given position.

Source

pub fn insert_at_back(&self, belt_stack_size: Option<u8>, items: LuaAny) -> bool

Insert items at the back of this line.

Source

pub fn line_equals(&self, other: LuaTransportLine) -> bool

Returns whether the associated internal transport line of this line is the same as the others associated internal transport line.

This can return true even when the LuaTransportLine::owners are different (so this == other is false), because the internal transport lines can span multiple tiles.

Source

pub fn remove_item(&self, items: LuaAny) -> u32

Remove some items from this line.

Trait Implementations§

Source§

impl Clone for LuaTransportLine

Source§

fn clone(&self) -> LuaTransportLine

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LuaTransportLine

Source§

impl Debug for LuaTransportLine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LuaTransportLine

Source§

fn default() -> LuaTransportLine

Returns the “default value” for a type. Read more
Source§

impl Eq for LuaTransportLine

Source§

impl From<LuaTransportLine> for LuaAny

Source§

fn from(_: LuaTransportLine) -> Self

Converts to this type from the input type.
Source§

impl LuaObject for LuaTransportLine

Source§

impl PartialEq for LuaTransportLine

Source§

fn eq(&self, other: &LuaTransportLine) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LuaTransportLine

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.