Tools for working with tiles.
A tile represents a 1 unit2 on a surface in Factorio.
local Tile = require('stdlib/area/tile')
adjacent (surface, position[, diagonal=false][, tile_name]) | Creates an array of tile positions for all adjacent tiles (N, E, S, W) OR (N, NE, E, SE, S, SW, W, NW) if diagonal is set to true. |
from_position (position) | Get the tile position of a tile where the given position resides. |
get_data (surface, tile_pos[, default_value]) | Gets the user data that is associated with a tile. |
get_index (tile_pos) | Calculates and returns a stable and deterministic integer ID of a tile from a given tile position. |
set_data (surface, tile_pos, data) | Associates the user data to a tile. |
to_area (tile_pos) | Converts a tile position to the area of the tile it is in. |
Creates an array of tile positions for all adjacent tiles (N, E, S, W) OR (N, NE, E, SE, S, SW, W, NW) if diagonal is set to true.
Parameters:
Get the tile position of a tile where the given position resides.
Parameters:
Gets the user data that is associated with a tile.
The user data is stored in the global object and it persists between loads.
Parameters:Calculates and returns a stable and deterministic integer ID of a tile from a given tile position.
The tile ID will not change once it is calculated, and every tile ID is unique to the chunk they are in and they may repeat across a surface.
Parameters:Associates the user data to a tile.
The user data will be stored in the global object and it will persist between loads.
Parameters:Converts a tile position to the area of the tile it is in.
Parameters: