mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
lightsource randomiser hash will be same even when x < 0
This commit is contained in:
@@ -170,7 +170,7 @@ open class GameWorld : Disposable {
|
||||
//val wireArray: ByteArray
|
||||
// get() = layerWire.data
|
||||
|
||||
private fun coerceXY(x: Int, y: Int) = (x fmod width) to (y.coerceIn(0, height - 1))
|
||||
fun coerceXY(x: Int, y: Int) = (x fmod width) to (y.coerceIn(0, height - 1))
|
||||
|
||||
fun getTileFromWall(rawX: Int, rawY: Int): Int {
|
||||
val (x, y) = coerceXY(rawX, rawY)
|
||||
@@ -182,6 +182,9 @@ open class GameWorld : Disposable {
|
||||
return layerTerrain.unsafeGetTile(x, y)
|
||||
}
|
||||
|
||||
fun getTileFromWallRaw(coercedX: Int, coercedY: Int) = layerWall.unsafeGetTile(coercedX, coercedY)
|
||||
fun getTileFromTerrainRaw(coercedX: Int, coercedY: Int) = layerTerrain.unsafeGetTile(coercedX, coercedY)
|
||||
|
||||
/**
|
||||
* Set the tile of wall as specified, with damage value of zero.
|
||||
* @param x
|
||||
|
||||
Reference in New Issue
Block a user