Home

LuaSpacePlatform

A space platform.

Attributes

force

The force of this space platform.

name

The name of this space platform.

index

The unique index of this space platform.

space_location

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

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

space_connection

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

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

The current state of this space platform.

paused

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

starter_pack

The starter pack used to create this space platform.

surface

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

hub

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

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

scheduled_for_deletion

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

The total weight of the platform.

damaged_tiles

The damaged tiles on this platform.

ejected_items

All items that have been thrown overboard.

hidden

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

valid

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

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.

Methods

destroy

LuaSpacePlatform.destroy(ticks?: uint32)

Call As

spacePlatform.destroy()

Call Convention

Schedules this space platform for deletion.

Parameters

cancel_deletion

LuaSpacePlatform.cancel_deletion()

Call As

spacePlatform.cancel_deletion()

Call Convention

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

apply_starter_pack

LuaSpacePlatform.apply_starter_pack() -> LuaEntity?

Call As

spacePlatform.apply_starter_pack()

Call Convention

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

Returns

damage_tile

LuaSpacePlatform.damage_tile{ position: TilePosition, damage: float, cause?: LuaEntity }

Call As

spacePlatform.damage_tile{ position=position, damage=damage }

Call Convention

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

Parameters

repair_tile

LuaSpacePlatform.repair_tile(position: TilePosition, amount?: float)

Call As

spacePlatform.repair_tile(position, amount)

Call Convention

Repairs the given tile if it's damaged.

Parameters

destroy_asteroid_chunks

LuaSpacePlatform.destroy_asteroid_chunks{ area?: BoundingBox, position?: MapPosition, name?: AsteroidChunkID | Array<AsteroidChunkID>, limit?: uint32, invert?: boolean } -> uint32

Call As

spacePlatform.destroy_asteroid_chunks{ area=area }

Call Convention

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

Parameters

Returns

create_asteroid_chunks

LuaSpacePlatform.create_asteroid_chunks(asteroid_chunks: Array<AsteroidChunk>)

Call As

spacePlatform.create_asteroid_chunks(asteroid_chunks)

Call Convention

Creates the given asteroid chunks on this platform.

Parameters

find_asteroid_chunks_filtered

LuaSpacePlatform.find_asteroid_chunks_filtered{ area?: BoundingBox, position?: MapPosition, name?: AsteroidChunkID | Array<AsteroidChunkID>, limit?: uint32, invert?: boolean } -> Array<AsteroidChunk>

Call As

spacePlatform.find_asteroid_chunks_filtered{ area=area }

Call Convention

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

Returns

can_leave_current_location

LuaSpacePlatform.can_leave_current_location() -> boolean

Call As

spacePlatform.can_leave_current_location()

Call Convention

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

Returns

get_schedule

LuaSpacePlatform.get_schedule() -> LuaSchedule

Call As

spacePlatform.get_schedule()

Call Convention

Returns

eject_item

LuaSpacePlatform.eject_item(item: ItemStackIdentification, position: MapPosition, movement: Vector)

Call As

spacePlatform.eject_item(item, position, movement)

Call Convention

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

clear_ejected_items

LuaSpacePlatform.clear_ejected_items()

Call As

spacePlatform.clear_ejected_items()

Call Convention

Removes all ejected items from this space platform.