Factorio Runtime DocsVersion 2.0.37

ClassLuaSchedulenew

The schedule of a particular LuaTrain or LuaSpacePlatform.

Members

add_wait_condition(record_index, condition_index, type)

Adds the given wait condition to the given record.

Adds the given wait condition to the given record.

remove_wait_condition(record_index, condition_index)

Removes the given wait condition from the given record.

Removes the given wait condition from the given record.

set_wait_condition_mode(record_index, condition_index, mode)

Sets the comparison on the given wait condition.

Sets the comparison on the given wait condition.

change_wait_condition(record_index, condition_index, wait_condition)

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

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

add_record(data)

Adds a record to the end of the current schedule using the provided data.

Adds a record to the end of the current schedule using the provided data.

remove_record(index)

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

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

copy_record(source_schedule, source_index, destination_index)

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

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

add_interrupt(interrupt)

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

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

remove_interrupt(index)

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

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

activate_interrupt(index)

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

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

change_interrupt(index, interrupt)

Changes the interrupt at the given index to the provided values. [...]

Changes the interrupt at the given index to the provided values. [...]

rename_interrupt(old_name, new_name)
go_to_station(schedule_index)
set_stopped(stopped)
set_allow_unloading(index, allow)

Sets if unloading is allowed at the given schedule index.

Sets if unloading is allowed at the given schedule index.

drag_record(from, to, interrupt_index?)
drag_interrupt(from, to)
drag_wait_condition(index, from, to)
get_record(index) ScheduleRecord?
get_interrupt(index) ScheduleInterrupt?
get_wait_condition(schedule_index, condition_index) WaitCondition?

Gets the wait condition at the given index if one exists.

Gets the wait condition at the given index if one exists.

get_wait_conditions(schedule_index) → array[WaitCondition]?

Gets the wait conditions at the given index if they exist.

Gets the wait conditions at the given index if they exist.

get_wait_condition_count(index) uint?

The number of wait conditions in the given schedule record.

The number of wait conditions in the given schedule record.

get_record_count(interrupt_index?) uint?

If the given index is invalid, nil is returned.

If the given index is invalid, nil is returned.

owner :: R LuaTrain or LuaSpacePlatform?

The owner of this schedule.

The owner of this schedule.

interrupt_count :: R uint
current :: R uint
tick_of_last_schedule_change :: R MapTick
tick_of_last_activity :: RW MapTick

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

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

ticks_in_station :: R MapTick
group :: RW string?

The group this schedule is part of, if any.

The group this schedule is part of, if any.

valid :: R boolean

Is this object valid? [...]

Is this object valid? [...]

object_name :: R string

The class name of this object. [...]

The class name of this object. [...]

Methods

add_wait_condition(record_index, condition_index, type)

Adds the given wait condition to the given record.

Parameters

record_index :: ScheduleRecordPosition
condition_index :: uint
type :: WaitCondition


remove_wait_condition(record_index, condition_index)

Removes the given wait condition from the given record.

Parameters

record_index :: ScheduleRecordPosition
condition_index :: uint


set_wait_condition_mode(record_index, condition_index, mode)

Sets the comparison on the given wait condition.

Parameters

record_index :: ScheduleRecordPosition
condition_index :: uint
mode :: string

"and", or "or"

"and", or "or"


change_wait_condition(record_index, condition_index, wait_condition)

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

Parameters

record_index :: ScheduleRecordPosition
condition_index :: uint
wait_condition :: WaitCondition


add_record(data)

Adds a record to the end of the current schedule using the provided data.

Parameters

data :: AddRecordData


remove_record(index)

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

Parameters


copy_record(source_schedule, source_index, destination_index)

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

Parameters

source_schedule :: LuaSchedule
source_index :: uint
destination_index :: uint


add_interrupt(interrupt)

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

Parameters

interrupt :: ScheduleInterrupt


remove_interrupt(index)

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

Parameters

index :: uint


activate_interrupt(index)

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

Parameters

index :: uint


change_interrupt(index, interrupt)

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

Parameters

index :: uint
interrupt :: ScheduleInterrupt


rename_interrupt(old_name, new_name)

Parameters

old_name :: string

The interrupt to rename

The interrupt to rename

new_name :: string

The new name - if it already exists, does nothing.

The new name - if it already exists, does nothing.


go_to_station(schedule_index)

Parameters

schedule_index :: uint

The schedule index

The schedule index


set_stopped(stopped)

Parameters

stopped :: boolean


set_allow_unloading(index, allow)

Sets if unloading is allowed at the given schedule index.

Parameters

index :: ScheduleRecordPosition
allow :: boolean


drag_record(from, to, interrupt_index?)

Parameters

from :: uint
to :: uint
interrupt_index :: uint?

The interrupt to operate on, if any.

The interrupt to operate on, if any.


drag_interrupt(from, to)

Parameters

from :: uint
to :: uint


drag_wait_condition(index, from, to)

Parameters

index :: ScheduleRecordPosition

The record to change.

The record to change.

from :: uint
to :: uint


get_record(index) → ScheduleRecord?

Parameters


get_interrupt(index) → ScheduleInterrupt?

Parameters

index :: uint


get_wait_condition(schedule_index, condition_index) → WaitCondition?

Gets the wait condition at the given index if one exists.

Parameters

schedule_index :: ScheduleRecordPosition
condition_index :: uint


get_wait_conditions(schedule_index) → array[WaitCondition]?

Gets the wait conditions at the given index if they exist.

Parameters

schedule_index :: ScheduleRecordPosition


get_wait_condition_count(index) → uint?

The number of wait conditions in the given schedule record.

Parameters


get_record_count(interrupt_index?) → uint?

If the given index is invalid, nil is returned.

Parameters

interrupt_index :: uint?

If provided, the record count in this interrupt is read.

If provided, the record count in this interrupt is read.

Attributes

owner :: Read LuaTrain or LuaSpacePlatform  ?

The owner of this schedule.


interrupt_count :: Read uint  


current :: Read uint  


tick_of_last_schedule_change :: Read MapTick  


tick_of_last_activity :: Read|Write MapTick  

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


ticks_in_station :: Read MapTick  


group :: Read|Write string  ?

The group this schedule is part of, if any.


valid :: Read boolean  

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.


object_name :: Read string  

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.

Classes

Concepts

Events

Defines