VyrekaMap

interface VyrekaMap(source)

A map of locations that are arranged in a 3-dimensional grid. Each location within bounds should contain a cell, except stated otherwise by an implementation. A cell can be accessed through its location. The map has a width, height and depth, which represent the x, y and z axes respectively.

Since

1.0.0

See also

Inheritors

Properties

Link copied to clipboard
abstract val depth: Int

The depth of the map, represented as the z-axis.

Link copied to clipboard
abstract val height: Int

The height of the map, represented as the y-axis.

Link copied to clipboard
abstract val width: Int

The width of the map, represented as the x-axis.

Functions

Link copied to clipboard
open fun getCellAt(location: Location): Cell

Tries to retrieve a cell at the given location. If there is no cell at the location, for example since the location is out of bounds, an exception is thrown. This method should only be used if it is guaranteed that there is a cell at the location.

Link copied to clipboard
abstract fun getCellAtOrNull(location: Location): Cell?

Tries to retrieve a cell at the given location. If there is no cell at the location, for example since the location is out of bounds, null is returned. However, as long as the location is within the bounds of the map, this method should never return null.

Link copied to clipboard
abstract fun getCellsFlattened(): List<Cell>

Creates a list of all cells in the map. The order of the cells is not specified and may vary between different implementations.

Link copied to clipboard
abstract fun removeCellAt(location: Location): Cell?

Removes the cell at the given location. If there is no cell at the location, null is returned. Otherwise, the removed cell is returned.

Link copied to clipboard
abstract fun setCell(cell: Cell)

Sets the cell at the given location to the given cell. If there is already a cell at the location, it will be overwritten by the new cell.