Factorio.com|Forums|Wiki|Mod Portal|API Docs Prototype|Runtime|Auxiliary

# Factorio Runtime Docs Version 2.0.7

## Class LuaSpacePlatform new

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() | → LuaEntity? | 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?=…} |  | 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. [...]
force | :: R LuaForce | The force of this space platform.
The force of this space platform.
name | :: R string | The name of this space platform.
The name of this space platform.
index | :: R uint | The unique index of this space platform.
The unique index of this space platform.
space_location | :: R LuaSpaceLocationPrototype | The space location this space platform is stopped at or `nil`.
The space location this space platform is stopped at or `nil`.
state | :: R defines.space_platform_state | The current state of this space platform.
The current state of this space platform.
starter_pack | :: R LuaItemPrototype | 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. [...]
The hub on this platform. [...]
schedule | :: RW PlatformSchedule? | This platform's current schedule, if any. [...]
This platform's current schedule, if any. [...]
speed | :: RW double |
scheduled_for_deletion | :: R uint | If this platform is scheduled for deletion. [...]
If this platform is scheduled for deletion. [...]
weight | :: R uint | 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.
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 | :: uint? | 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() → LuaEntity?

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

#### 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?=…}

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 | :: uint? |
invert | :: boolean? | If the filters should be inverted.
If the filters should be inverted.

### 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 | :: uint? |
invert | :: boolean? | If the filters should be inverted.
If the filters should be inverted.

#### Example

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

## Attributes

### force :: Read LuaForce

The force of this space platform.

### name :: Read string

The name of this space platform.

### index :: Read uint

The unique index of this space platform.

### space_location :: Read LuaSpaceLocationPrototype

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

### state :: Read defines.space_platform_state

The current state of this space platform.

### starter_pack :: Read LuaItemPrototype

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. `nil` if the platform has not had the starter pack applied or hub was destroyed but the platform not yet deleted.

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

### 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.

### speed :: Read|Write double

### scheduled_for_deletion :: Read uint

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 uint

The total weight of the platform.

### damaged_tiles :: Read array[table]

The damaged tiles on this platform.

#### Table fields

position | :: TilePosition |
damage | :: float |

### 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.