Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaTile - Runtime Docs

## Class LuaTile

A single "square" on the map.

## Members

collides_with(layer) | → boolean | What type of things can collide with this tile?
What type of things can collide with this tile?
to_be_deconstructed(force?) | → boolean | Is this tile marked for deconstruction?
Is this tile marked for deconstruction?
order_deconstruction(force, player?) | → LuaEntity? | Orders deconstruction of this tile by the given force.
Orders deconstruction of this tile by the given force.
cancel_deconstruction(force, player?) |  | Cancels deconstruction if it is scheduled, does nothing otherwise.
Cancels deconstruction if it is scheduled, does nothing otherwise.
has_tile_ghost(force?) | → boolean | Does this tile have any tile ghosts on it.
Does this tile have any tile ghosts on it.
get_tile_ghosts(force?) | → array[LuaEntity] | Gets all tile ghosts on this tile.
Gets all tile ghosts on this tile.
name | :: R string | Prototype name of this tile. [...]
Prototype name of this tile. [...]
prototype | :: R LuaTilePrototype |
position | :: R TilePosition | The position this tile references.
The position this tile references.
hidden_tile | :: R string? | The name of the LuaTilePrototype hidden under this tile, if any. [...]
The name of the LuaTilePrototype hidden under this tile, if any. [...]
double_hidden_tile | :: R string? | The name of the LuaTilePrototype double hidden under this tile or `nil` if there is no double hidden tile. [...]
The name of the LuaTilePrototype double hidden under this tile or `nil` if there is no double hidden tile. [...]
surface | :: R LuaSurface | The surface this tile is on.
The surface this tile is on.
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

### collides_with(layer) → boolean

What type of things can collide with this tile?

#### Parameters

layer | :: CollisionLayerID |

#### Example

    -- Check if the character would collide with a tile
    game.player.print(tostring(game.player.surface.get_tile(1, 1).collides_with("player")))

### to_be_deconstructed(force?) → boolean

Is this tile marked for deconstruction?

#### Parameters

force | :: ForceID? | The force whose robots are supposed to do the deconstruction. If not given, checks if to be deconstructed by any force.
The force whose robots are supposed to do the deconstruction. If not given, checks if to be deconstructed by any force.

### order_deconstruction(force, player?) → LuaEntity?

Orders deconstruction of this tile by the given force.

#### Parameters

force | :: ForceID | The force whose robots are supposed to do the deconstruction.
The force whose robots are supposed to do the deconstruction.
player | :: PlayerIdentification? | The player to set the last_user to if any.
The player to set the last_user to if any.

#### Return values

→ LuaEntity? | The deconstructible tile proxy created, if any.

#### Raised events

on_marked_for_deconstruction? instantly | Raised if the tile was successfully marked for deconstruction.

### cancel_deconstruction(force, player?)

Cancels deconstruction if it is scheduled, does nothing otherwise.

#### Parameters

force | :: ForceID | The force who did the deconstruction order.
The force who did the deconstruction order.
player | :: PlayerIdentification? | The player to set the last_user to if any.
The player to set the last_user to if any.

#### Raised events

on_cancelled_deconstruction? instantly | Raised if the tile's deconstruction was successfully cancelled.

### has_tile_ghost(force?) → boolean

Does this tile have any tile ghosts on it.

#### Parameters

force | :: ForceID? | Check for tile ghosts of this force.
Check for tile ghosts of this force.

### get_tile_ghosts(force?) → array[LuaEntity]

Gets all tile ghosts on this tile.

#### Parameters

force | :: ForceID? | Get tile ghosts of this force.
Get tile ghosts of this force.

#### Return values

→ array[LuaEntity] | The tile ghosts.

## Attributes

### name :: Read string

Prototype name of this tile. E.g. `"sand-3"` or `"grass-2"`.

### prototype :: Read LuaTilePrototype

### position :: Read TilePosition

The position this tile references.

### hidden_tile :: Read string?

The name of the LuaTilePrototype hidden under this tile, if any.

During normal gameplay, only non-mineable or foundation tiles can become hidden. This can however be circumvented with LuaSurface::set_hidden_tile.

### double_hidden_tile :: Read string?

The name of the LuaTilePrototype double hidden under this tile or `nil` if there is no double hidden tile.

During normal gameplay, only non-mineable tiles can become double hidden. This can however be circumvented with LuaSurface::set_double_hidden_tile.

### surface :: Read LuaSurface

The surface this tile is on.

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

Class used in

- LuaControl::mine_tile()
- LuaItemCommon::set_tile_filter()
- LuaRecord::set_tile_filter()
- LuaSurface::find_tiles_filtered()
- LuaSurface::get_tile()
- TileID
- on_player_alt_reverse_selected_area
- on_player_alt_selected_area
- on_player_reverse_selected_area
- on_player_selected_area