mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
fix: wall breakage would use wrong texture
This commit is contained in:
@@ -373,8 +373,8 @@ internal object BlocksDrawer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val breakage = if (mode == TERRAIN) world.getTerrainDamage(x, y) else if (mode == WALL) world.getWallDamage(x, y) else 0f
|
val breakage = if (mode == TERRAIN) world.getTerrainDamage(x, y) else if (mode == WALL) world.getWallDamage(x, y) else 0f
|
||||||
val maxHealth = if (mode == TERRAIN || mode == WALL) BlockCodex[world.getTileFromTerrain(x, y)].strength else 1
|
val maxHealth = if (mode == TERRAIN) BlockCodex[world.getTileFromTerrain(x, y)].strength else if (mode == WALL) BlockCodex[world.getTileFromWall(x, y)].strength else 1
|
||||||
val breakingStage = if (mode == TERRAIN || mode == WALL) (breakage / maxHealth).times(BREAKAGE_STEPS).roundToInt() else 0
|
val breakingStage = if (mode == TERRAIN || mode == WALL) (breakage / maxHealth).coerceIn(0f, 1f).times(BREAKAGE_STEPS).roundToInt() else 0
|
||||||
|
|
||||||
// draw a tile
|
// draw a tile
|
||||||
writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, breakingStage)
|
writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, breakingStage)
|
||||||
|
|||||||
Reference in New Issue
Block a user