Skip to main content

Tile

Tiles have a custom comparison function that allows two instances to be compared directly: tile_a == tile_b

tile:x()

Returns the column of the tile.

tile:y()

Returns the row of the tile.

tile:width()

Returns the width of the tile in pixels.

tile:height()

Returns the height of the tile in pixels.

tile:state()

Returns the TileState.

tile:set_state(tile_state)

  • tile_state
    • TileState.Void
    • TileState.Normal
    • TileState.PermaHole
    • TileState.Cracked
    • TileState.Broken
    • TileState.[state_name]

tile:can_set_state(tile_state)

Returns true if the currently applied tile state can be replaced with tile_state

tile:visible_state()

Returns a TileState, usually the same as tile:state(), unless tile:set_visible_state() was called.

tile:set_visible_state(tile_state?)

Overrides the visual for the tile to match a tile state, or set to nil to sync with tile:state()

tile:is_edge()

Returns true if the tile is one of the hidden padding tiles around the edge of the field.

tile:is_walkable()

Returns true if the tile is not a hole.

Examples: TileState.Broken, TileState.Void, TileState.Empty

tile:is_reserved(exclude_list?)

Returns true if there's any reservations for this tile, excluding entities with ids matching the exclude_list.

tile:reserve_count_for(entity)

Returns a number, representing the total reservation count for this Entity.

tile:reserve_for(entity)

Adds a reservation of this tile for this Entity.

tile:remove_reservation_for(entity)

Removes a reservation for this tile for this Entity.

tile:reserve_for_id(entity_id)

Adds a reservation of this tile for this Entity using an entity id.

tile:remove_reservation_for_id(entity_id)

Removes a reservation of this tile for this Entity using an entity id.

tile:team()

Returns Team

tile:set_team(team, direction)

  • team: Team
  • direction: Direction override for the duration of the team change.

tile:original_team()

Returns Team

tile:facing()

Returns a Direction

tile:set_facing(direction)

Sets the facing direction used to set the initial direction of spawned entities, as well as for resolving reverting team.

tile:set_highlight(highlight)

  • highlight
    • Highlight.None
    • Highlight.Flash
    • Highlight.Solid

tile:get_tile(direction, distance)

Returns a Tile count many tiles in direction's direction, or nil.

tile:attack_entities(spell)

Same as spell:attack_tile(tile)

tile:contains_entity(entity)

Returns true if the Entity is on the field and at the same position as the tile.

tile:add_entity(entity)

Moves the Entity to this tile if the entity is spawned.

tile:remove_entity(entity)

Removes the Entity from the field.

tile:remove_entity_by_id(entity_id)

Removes the Entity from the field.

tile:find_entities(function(entity): boolean)

Returns a list of entities for any entity the callback returned true for.

Only Entities on the field and not marked for deletion will be passed to the callback.

tile:find_characters(function(entity): boolean)

Returns a list of entities for any entity the callback returned true for.

Only Characters on the field and not marked for deletion will be passed to the callback.

tile:find_obstacles(function(entity): boolean)

Returns a list of entities for any entity the callback returned true for.

Only Obstacles on the field and not marked for deletion will be passed to the callback.

tile:find_players(function(entity): boolean)

Returns a list of entities for any entity the callback returned true for.

Only Players on the field and not marked for deletion will be passed to the callback.

tile:find_spells(function(entity): boolean)

Returns a list of entities for any entity the callback returned true for.

Only Spells will be passed to the callback.