package ru.dbotthepony.kstarbound.world.api

import ru.dbotthepony.kommons.util.IStruct2i
import ru.dbotthepony.kstarbound.world.ChunkState

interface ICellAccess {
	/**
	 * with wrap-around
	 */
	fun getCell(x: Int, y: Int): AbstractCell
	fun getCell(pos: IStruct2i) = getCell(pos.component1(), pos.component2())

	/**
	 * whenever cell was set
	 */
	fun setCell(x: Int, y: Int, cell: AbstractCell): Boolean
	fun setCell(pos: IStruct2i, cell: AbstractCell): Boolean = setCell(pos.component1(), pos.component2(), cell)

	fun setCell(x: Int, y: Int, cell: AbstractCell, chunkState: ChunkState): Boolean
	fun setCell(pos: IStruct2i, cell: AbstractCell, chunkState: ChunkState): Boolean = setCell(pos.component1(), pos.component2(), cell, chunkState)
}

