pub struct LuaSchedule;Expand description
The schedule of a particular LuaTrain or LuaSpacePlatform.
Implementations§
Source§impl LuaSchedule
impl LuaSchedule
pub fn interrupt_count(&self) -> u32
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 tick_of_last_activity(&self) -> u32
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
pub fn tick_of_last_schedule_change(&self) -> u32
Sourcepub fn ticks_in_station(&self) -> u32
pub fn ticks_in_station(&self) -> u32
How long this train or space platform has been in the current station.
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 activate_interrupt(&self, index: u32)
pub fn activate_interrupt(&self, index: u32)
Activates the interrupt at the given index, if the index is valid.
Sourcepub fn add_interrupt(&self, interrupt: ScheduleInterrupt)
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.
Sourcepub fn add_record(&self, data: AddRecordData) -> Option<u32>
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.
Sourcepub fn add_wait_condition(
&self,
condition_index: u32,
record_position: ScheduleRecordPosition,
type: WaitConditionType,
)
pub fn add_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, type: WaitConditionType, )
Adds the given wait condition to the given record.
Sourcepub fn change_interrupt(&self, index: u32, interrupt: ScheduleInterrupt)
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.
Sourcepub fn change_wait_condition(
&self,
condition_index: u32,
record_position: ScheduleRecordPosition,
wait_condition: WaitCondition,
)
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.
Sourcepub fn clear_interrupts(&self)
pub fn clear_interrupts(&self)
Removes all interrupts.
pub fn clear_records(&self, interrupt_index: Option<u32>)
Sourcepub fn copy_record(
&self,
destination_index: u32,
source_index: u32,
source_schedule: LuaSchedule,
)
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.
pub fn drag_interrupt(&self, from: u32, to: u32)
pub fn drag_record(&self, from: u32, interrupt_index: Option<u32>, to: u32)
pub fn drag_wait_condition( &self, from: u32, record_position: ScheduleRecordPosition, to: u32, )
Sourcepub fn get_inside_interrupt(&self, interrupt_index: u32) -> bool
pub fn get_inside_interrupt(&self, interrupt_index: u32) -> bool
Gets if the given interrupt can be triggered inside other interrupts.
pub fn get_interrupt(&self, index: u32) -> Option<ScheduleInterrupt>
pub fn get_interrupts(&self) -> Vec<ScheduleInterrupt>
pub fn get_record( &self, record_position: ScheduleRecordPosition, ) -> Option<ScheduleRecord>
Sourcepub fn get_record_count(&self, interrupt_index: Option<u32>) -> Option<u32>
pub fn get_record_count(&self, interrupt_index: Option<u32>) -> Option<u32>
If the given index is invalid, nil is returned.
pub fn get_records( &self, interrupt_index: Option<u32>, ) -> Option<Vec<ScheduleRecord>>
Sourcepub fn get_wait_condition(
&self,
condition_index: u32,
record_position: ScheduleRecordPosition,
) -> Option<WaitCondition>
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.
Sourcepub fn get_wait_condition_count(
&self,
record_position: ScheduleRecordPosition,
) -> Option<u32>
pub fn get_wait_condition_count( &self, record_position: ScheduleRecordPosition, ) -> Option<u32>
The number of wait conditions in the given schedule record.
Sourcepub fn get_wait_conditions(
&self,
record_position: ScheduleRecordPosition,
) -> Option<Vec<WaitCondition>>
pub fn get_wait_conditions( &self, record_position: ScheduleRecordPosition, ) -> Option<Vec<WaitCondition>>
Gets the wait conditions at the given record position if they exist.
Sourcepub fn go_to_station(&self, schedule_index: u32)
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.
Sourcepub fn remove_interrupt(&self, index: u32)
pub fn remove_interrupt(&self, index: u32)
Removes the interrupt at the given index, if the index is valid.
Sourcepub fn remove_record(&self, record_position: ScheduleRecordPosition)
pub fn remove_record(&self, record_position: ScheduleRecordPosition)
Removes the record at the given record position, if the record position is valid.
Sourcepub fn remove_wait_condition(
&self,
condition_index: u32,
record_position: ScheduleRecordPosition,
)
pub fn remove_wait_condition( &self, condition_index: u32, record_position: ScheduleRecordPosition, )
Removes the given wait condition from the given record.
pub fn rename_interrupt(&self, new_name: &str, old_name: &str)
Sourcepub fn set_allow_unloading(
&self,
allow: bool,
record_position: ScheduleRecordPosition,
)
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.
Sourcepub fn set_inside_interrupt(&self, interrupt_index: u32, value: bool)
pub fn set_inside_interrupt(&self, interrupt_index: u32, value: bool)
Sets if the given interrupt can be triggered inside other interrupts.
pub fn set_interrupts(&self, interrupts: Vec<ScheduleInterrupt>)
pub fn set_records( &self, interrupt_index: Option<u32>, records: Vec<ScheduleRecord>, )
Sourcepub fn set_stopped(&self, stopped: bool)
pub fn set_stopped(&self, stopped: bool)
Sets whether this train is in manual mode or this space platform is paused.
Sourcepub fn set_wait_condition_mode(
&self,
condition_index: u32,
mode: &str,
record_position: ScheduleRecordPosition,
)
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
impl Clone for LuaSchedule
Source§fn clone(&self) -> LuaSchedule
fn clone(&self) -> LuaSchedule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more