area.tile
Methods5
function Tile.adjacent(surface: LuaSurface, position: TilePosition, diagonal: nil | boolean, tile_name) -> TilePosition[]
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.
surfaceLuaSurfacethe surface to examine for adjacent tiles
positionTilePositionthe tile position of the origin tile
diagonalnil | boolean[opt=false] whether to include diagonal tiles
tile_name
- TilePosition[]
an array of tile positions of the tiles that are adjacent to the origin tile
@paramtile_name string? [opt] whether to restrict adjacent tiles to a particular tile name (example: "water-tile")
function Tile.get_data(surface: LuaSurface, tile_pos: TilePosition, default_value: any) -> any
Gets the user data that is associated with a tile. The user data is stored in the global object and it persists between loads.
surfaceLuaSurfacethe surface on which the user data is looked up
tile_posTilePositionthe tile position on which the user data is looked up
default_valueanythe user data to set for the tile and returned if it did not have user data
- any
the user data OR nil if it does not exist for the tile and no default_value was set
function Tile.get(surface: LuaSurface, tile_pos: TilePosition, default_value: any) -> any
surfaceLuaSurfacethe surface on which the user data is looked up
tile_posTilePositionthe tile position on which the user data is looked up
default_valueanythe user data to set for the tile and returned if it did not have user data
- any
the user data OR nil if it does not exist for the tile and no default_value was set
function Tile.set_data(surface: LuaSurface, tile_pos: TilePosition, value: any) -> any
Associates the user data to a tile. The user data will be stored in the global object and it will persist between loads.
surfaceLuaSurfacethe surface on which the user data will reside
tile_posTilePositionthe tile position of a tile that will be associated with the user data
valueanythe user data to set OR nil to erase the existing user data for the tile
- any
the previous user data associated with the tile OR nil if the tile had no previous user data
function Tile.set(surface: LuaSurface, tile_pos: TilePosition, value: any) -> any
surfaceLuaSurfacethe surface on which the user data will reside
tile_posTilePositionthe tile position of a tile that will be associated with the user data
valueanythe user data to set OR nil to erase the existing user data for the tile
- any
the previous user data associated with the tile OR nil if the tile had no previous user data
Fields5
Tile.__class: string = "Tile"
Tile.__index : unknown
Tile.__call : any
Tile.from_position : any
Get the @{TilePosition|tile position} of a tile where the given position resides. @function Tile.from_position @see StdLib.Area.Position.floor
Tile.to_area : any
Converts a tile position to the @{BoundingBox|area} of the tile it is in. @function Tile.to_area @see StdLib.Area.Position.totilearea