Skip to main content

LuaSchedule

Struct LuaSchedule 

Source
pub struct LuaSchedule;
Expand description

The schedule of a particular LuaTrain or LuaSpacePlatform.

Implementations§

Source§

impl LuaSchedule

Source

pub fn current(&self) -> u32

The schedule index of the current destination.

Source

pub fn group(&self) -> &str

The group this schedule is part of, if any.

Source

pub fn interrupt_count(&self) -> u32

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 owner(&self) -> LuaAny

The owner of this schedule.

Source

pub fn tick_of_last_activity(&self) -> u32

The time when the train or space platform was last considered active for the inactivity condition.

Note: when writing, value must not be larger than LuaGameScript::tick

Source

pub fn tick_of_last_schedule_change(&self) -> u32

Source

pub fn ticks_in_station(&self) -> u32

How long this train or space platform has been in the current station.

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 activate_interrupt(&self, index: u32)

Activates the interrupt at the given index, if the index is valid.

Source

pub fn add_interrupt(&self, interrupt: ScheduleInterrupt)

Adds the given interrupt to the schedule if an interrupt with the given name does not already exist.

Source

pub fn add_record(&self, data: AddRecordData) -> Option<u32>

Adds the given record to the end of the current schedule or at the given index using the provided data.

Source

pub fn add_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, type: WaitConditionType, )

Adds the given wait condition to the given record.

Source

pub fn change_interrupt(&self, index: u32, interrupt: ScheduleInterrupt)

Changes the interrupt at the given index to the provided values. Note, the names must match.

Source

pub fn change_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, wait_condition: WaitCondition, )

Changes the wait condition on the given record to the new values.

Source

pub fn clear_interrupts(&self)

Removes all interrupts.

Source

pub fn clear_records(&self, interrupt_index: Option<u32>)

Source

pub fn copy_record( &self, destination_index: u32, source_index: u32, source_schedule: LuaSchedule, )

Copies the record from the given schedule at the given index into this schedule at the given index.

Source

pub fn drag_interrupt(&self, from: u32, to: u32)

Source

pub fn drag_record(&self, from: u32, interrupt_index: Option<u32>, to: u32)

Source

pub fn drag_wait_condition( &self, from: u32, record_position: ScheduleRecordPosition, to: u32, )

Source

pub fn get_inside_interrupt(&self, interrupt_index: u32) -> bool

Gets if the given interrupt can be triggered inside other interrupts.

Source

pub fn get_interrupt(&self, index: u32) -> Option<ScheduleInterrupt>

Source

pub fn get_interrupts(&self) -> Vec<ScheduleInterrupt>

Source

pub fn get_record( &self, record_position: ScheduleRecordPosition, ) -> Option<ScheduleRecord>

Source

pub fn get_record_count(&self, interrupt_index: Option<u32>) -> Option<u32>

If the given index is invalid, nil is returned.

Source

pub fn get_records( &self, interrupt_index: Option<u32>, ) -> Option<Vec<ScheduleRecord>>

Source

pub fn get_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, ) -> Option<WaitCondition>

Gets the wait condition at the given record position if one exists.

Source

pub fn get_wait_condition_count( &self, record_position: ScheduleRecordPosition, ) -> Option<u32>

The number of wait conditions in the given schedule record.

Source

pub fn get_wait_conditions( &self, record_position: ScheduleRecordPosition, ) -> Option<Vec<WaitCondition>>

Gets the wait conditions at the given record position if they exist.

Source

pub fn go_to_station(&self, schedule_index: u32)

Sets the train or space platform to go to a destination, including changing the train/space platform to automatic mode.

Source

pub fn remove_interrupt(&self, index: u32)

Removes the interrupt at the given index, if the index is valid.

Source

pub fn remove_record(&self, record_position: ScheduleRecordPosition)

Removes the record at the given record position, if the record position is valid.

Source

pub fn remove_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, )

Removes the given wait condition from the given record.

Source

pub fn rename_interrupt(&self, new_name: &str, old_name: &str)

Source

pub fn set_allow_unloading( &self, allow: bool, record_position: ScheduleRecordPosition, )

Sets if unloading is allowed at the given schedule record position. Only relevant for space platforms.

Source

pub fn set_inside_interrupt(&self, interrupt_index: u32, value: bool)

Sets if the given interrupt can be triggered inside other interrupts.

Source

pub fn set_interrupts(&self, interrupts: Vec<ScheduleInterrupt>)

Source

pub fn set_records( &self, interrupt_index: Option<u32>, records: Vec<ScheduleRecord>, )

Source

pub fn set_stopped(&self, stopped: bool)

Sets whether this train is in manual mode or this space platform is paused.

Source

pub fn set_wait_condition_mode( &self, condition_index: u32, mode: &str, record_position: ScheduleRecordPosition, )

Sets the comparison on the given wait condition.

Trait Implementations§

Source§

impl Clone for LuaSchedule

Source§

fn clone(&self) -> LuaSchedule

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 LuaSchedule

Source§

impl Debug for LuaSchedule

Source§

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

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

impl Default for LuaSchedule

Source§

fn default() -> LuaSchedule

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

impl Eq for LuaSchedule

Source§

impl From<LuaSchedule> for LuaAny

Source§

fn from(_: LuaSchedule) -> Self

Converts to this type from the input type.
Source§

impl LuaObject for LuaSchedule

Source§

impl PartialEq for LuaSchedule

Source§

fn eq(&self, other: &LuaSchedule) -> 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 LuaSchedule

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.