Factorio Runtime DocsVersion 2.1.8

LuaSpacePlatform - Runtime Docs

ClassLuaSpacePlatformchanged

A space platform.

Members

destroy(ticks?)

Schedules this space platform for deletion.

Schedules this space platform for deletion.

cancel_deletion()

Cancels deletion of this space platform if it was scheduled for deletion.

Cancels deletion of this space platform if it was scheduled for deletion.

apply_starter_pack(silent?) changedLuaEntity?

Applies the starter pack for this platform if it hasn't already been applied.

Applies the starter pack for this platform if it hasn't already been applied.

damage_tile{position=…, damage=…, cause?=…}

Damages the given tile if it exists, the chunk is generated, and it is a platform foundation tile.

Damages the given tile if it exists, the chunk is generated, and it is a platform foundation tile.

repair_tile(position, amount?)

Repairs the given tile if it's damaged.

Repairs the given tile if it's damaged.

destroy_asteroid_chunks{area?=…, position?=…, name?=…, limit?=…, invert?=…} uint32

Destroys all asteroid chunks from the given area. [...]

Destroys all asteroid chunks from the given area. [...]

create_asteroid_chunks(asteroid_chunks)

Creates the given asteroid chunks on this platform.

Creates the given asteroid chunks on this platform.

find_asteroid_chunks_filtered{area?=…, position?=…, name?=…, limit?=…, invert?=…} → array[AsteroidChunk]

Find asteroid chunks of a given name in a given area. [...]

Find asteroid chunks of a given name in a given area. [...]

can_leave_current_location() boolean

Returns true when the space platform isn't waiting on any delivery from the planet.

Returns true when the space platform isn't waiting on any delivery from the planet.

get_schedule() LuaSchedule

This allows full access to the space platform schedule, including modifying the schedule records, the group and the interrupts.

This allows full access to the space platform schedule, including modifying the schedule records, the group and the interrupts.

eject_item(item, position, movement)

Ejects an item into space on this space platform. [...]

Ejects an item into space on this space platform. [...]

clear_ejected_items()

Removes all ejected items from this space platform.

Removes all ejected items from this space platform.

force :: R LuaForce

The force of this space platform.

The force of this space platform.

name :: RW string

The name of this space platform.

The name of this space platform.

index :: R uint32

The unique index of this space platform.

The unique index of this space platform.

space_location changed :: R LuaSpaceLocationPrototype| W SpaceLocationID?

The space location this space platform is stopped at or nil. [...]

The space location this space platform is stopped at or nil. [...]

last_visited_space_location :: R LuaSpaceLocationPrototype?

The space location this space platform previously went through or stopped at.

The space location this space platform previously went through or stopped at.

space_connection changed :: R LuaSpaceConnectionPrototype| W SpaceConnectionID?

The space connection this space platform is traveling through or nil. [...]

The space connection this space platform is traveling through or nil. [...]

distance :: RW double?

The point on space connection this platform is at or nil. [...]

The point on space connection this platform is at or nil. [...]

state :: R defines.space_platform_state

The current state of this space platform.

The current state of this space platform.

paused :: RW boolean

When true, the platform has paused thrust and does not advance its schedule.

When true, the platform has paused thrust and does not advance its schedule.

starter_pack :: R ItemIDAndQualityIDPair?

The starter pack used to create this space platform.

The starter pack used to create this space platform.

surface :: R LuaSurface

The surface that belongs to this platform (if it has been created yet).

The surface that belongs to this platform (if it has been created yet).

hub :: R LuaEntity?

The hub on this platform, if it exists. [...]

The hub on this platform, if it exists. [...]

schedule :: RW PlatformSchedule?

This platform's current schedule, if any. [...]

This platform's current schedule, if any. [...]

speed :: RW double
scheduled_for_deletion :: R uint32

If this platform is scheduled for deletion. [...]

If this platform is scheduled for deletion. [...]

weight :: R Weight

The total weight of the platform.

The total weight of the platform.

damaged_tiles :: R array[table]

The damaged tiles on this platform.

The damaged tiles on this platform.

ejected_items :: R array[EjectedItem]

All items that have been thrown overboard.

All items that have been thrown overboard.

hidden :: RW boolean

If this platform is hidden from the remote view surface list.

If this platform is hidden from the remote view surface list.

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

destroy(ticks?)

Schedules this space platform for deletion.

Parameters

ticks :: MapTick?

The number of ticks from now when this platform will be deleted.

The number of ticks from now when this platform will be deleted.


cancel_deletion()

Cancels deletion of this space platform if it was scheduled for deletion.


apply_starter_pack(silent?) → LuaEntity?changed

Applies the starter pack for this platform if it hasn't already been applied.

Parameters

silent :: boolean?

If the platform creation is announced to players on the force. Defaults to false.

If the platform creation is announced to players on the force. Defaults to false.

Return values

→ LuaEntity?

The platform hub.


damage_tile{position=…, damage=…, cause?=…}

Damages the given tile if it exists, the chunk is generated, and it is a platform foundation tile.

Parameters

Table (optional) with the following fields:
position :: TilePosition
damage :: float
cause :: LuaEntity?


repair_tile(position, amount?)

Repairs the given tile if it's damaged.

Parameters

position :: TilePosition
amount :: float?


destroy_asteroid_chunks{area?=…, position?=…, name?=…, limit?=…, invert?=…} → uint32

Destroys all asteroid chunks from the given area. If no area and no position are given, then the entire surface is searched.

Parameters

Table with the following fields:
area :: BoundingBox?
position :: MapPosition?
name :: AsteroidChunkID or array[AsteroidChunkID]?
limit :: uint32?
invert :: boolean?

If the filters should be inverted.

If the filters should be inverted.

Return values

→ uint32

The number of destroyed chunks.


create_asteroid_chunks(asteroid_chunks)

Creates the given asteroid chunks on this platform.

Parameters

asteroid_chunks :: array[AsteroidChunk]


find_asteroid_chunks_filtered{area?=…, position?=…, name?=…, limit?=…, invert?=…} → array[AsteroidChunk]

Find asteroid chunks of a given name in a given area.

If no filters are given, returns all asteroid chunks in the search area. If multiple filters are specified, returns only asteroid chunks matching every given filter. If no area and no position are given, the entire surface is searched.

Parameters

Table with the following fields:
area :: BoundingBox?
position :: MapPosition?
name :: AsteroidChunkID or array[AsteroidChunkID]?
limit :: uint32?
invert :: boolean?

If the filters should be inverted.

If the filters should be inverted.

Example

game.forces.player.platforms[1].find_asteroid_chunks_filtered{area = {{-10, -10}, {10, 10}}, name = "carbonic-asteroid"} -- gets all asteroids with the given name in the rectangle
game.forces.player.platforms[1].find_asteroid_chunks_filtered{area = {{-10, -10}, {10, 10}}, limit = 5}  -- gets the first 5 asteroid chunks in the rectangle

can_leave_current_location() → boolean

Returns true when the space platform isn't waiting on any delivery from the planet.


get_schedule() → LuaSchedule

This allows full access to the space platform schedule, including modifying the schedule records, the group and the interrupts.


eject_item(item, position, movement)

Ejects an item into space on this space platform.

If a LuaItemStack is provided, the actual item is ejected and removed from the source.

Parameters

item :: ItemStackIdentification
position :: MapPosition
movement :: Vector

When inserters drop items into space, the InserterPrototype::insert_position rotated to the inserter direction is used.

When inserters drop items into space, the InserterPrototype::insert_position rotated to the inserter direction is used.


clear_ejected_items()

Removes all ejected items from this space platform.

Attributes

force :: Read LuaForce

The force of this space platform.


name :: Read|Write string

The name of this space platform.


index :: Read uint32

The unique index of this space platform.


space_location :: Read LuaSpaceLocationPrototype| Write SpaceLocationID?changed

The space location this space platform is stopped at or nil.

Write operation requires a valid space location and will cancel pending item requests.


last_visited_space_location :: Read LuaSpaceLocationPrototype?

The space location this space platform previously went through or stopped at.


space_connection :: Read LuaSpaceConnectionPrototype| Write SpaceConnectionID?changed

The space connection this space platform is traveling through or nil.

Write operation requires a valid space connection and it sets the distance to 0.5.


distance :: Read|Write double?

The point on space connection this platform is at or nil.

It is represented as a number in range [0, 1], with 0 being LuaSpaceConnectionPrototype::from and 1 being LuaSpaceConnectionPrototype::to.


state :: Read defines.space_platform_state

The current state of this space platform.


paused :: Read|Write boolean

When true, the platform has paused thrust and does not advance its schedule.


starter_pack :: Read ItemIDAndQualityIDPair?

The starter pack used to create this space platform.


surface :: Read LuaSurface

The surface that belongs to this platform (if it has been created yet).


hub :: Read LuaEntity?

The hub on this platform, if it exists. It does not exist if the platform has not had the starter pack applied.

If the hub dies the platform will be deleted at the end of the tick but is otherwise valid to use until that point.

If the hub is destroyed the platform is not affected.


schedule :: Read|Write PlatformSchedule?

This platform's current schedule, if any. Set to nil to clear.

The schedule can't be changed by modifying the returned table. Instead, changes must be made by assigning a new table to this attribute.

This is a simplified schedule that does not include groups and interrupts. See LuaSpacePlatform::get_schedule for full access to the schedule, including interrupts and groups.


speed :: Read|Write double


scheduled_for_deletion :: Read uint32

If this platform is scheduled for deletion.

Returns how many ticks are left before the platform will be deleted. 0 if not scheduled for deletion.


weight :: Read Weight

The total weight of the platform.


damaged_tiles :: Read array[table]

The damaged tiles on this platform.

Table fields

position :: TilePosition
damage :: float


ejected_items :: Read array[EjectedItem]

All items that have been thrown overboard.


hidden :: Read|Write boolean

If this platform is hidden from the remote view surface list.


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.

Fulltext search

Classes

Concepts

Events

Defines

Fulltext search for