mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 13:04:05 +09:00
illegal tile monitoring in-game
This commit is contained in:
@@ -173,14 +173,25 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns BlockBox definition as a list of individual blocks, relative to the given coord.
|
||||
*
|
||||
* @param posX start position of the BlockBox, top-left
|
||||
* @param posY start position of the BlockBox, top-left
|
||||
* @return real block positions, in List of Pair(x, y)
|
||||
* @return block positions, in List of Pair(x, y)
|
||||
*/
|
||||
open fun getBlockBoxPositions(posX: Int, posY: Int): List<Pair<Int, Int>> {
|
||||
return (posX until posX + blockBox.width).toList().cartesianProduct((posY until posY + blockBox.height).toList())
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns BlockBox definition as a list of individual blocks, absolute position in the world.
|
||||
*
|
||||
* @return in-world block positions, in List of Pair(x, y); `null` if the actor is not placed on the world
|
||||
*/
|
||||
fun getBlockBoxPositionsAbsolute(): List<Pair<Int, Int>>? = worldBlockPos?.let { (posX, posY) ->
|
||||
return getBlockBoxPositions(posX, posY)
|
||||
}
|
||||
|
||||
open fun canSpawnHere0(posX: Int, posY: Int): Boolean {
|
||||
val everyBlockboxPos = getBlockBoxPositions(posX, posY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user