mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-11 16:36:58 -04:00
world visibility graph: check correct chunk position
chunkPosition.x could already have been changed during the check and this random regions just disappear. Hell, one day I will rewrite this whole part and write tests...
This commit is contained in:
parent
1486cd9cf8
commit
25d4ab6fdc
@ -254,7 +254,7 @@ class WorldVisibilityGraph(
|
|||||||
val positionX = chunkPosition.x
|
val positionX = chunkPosition.x
|
||||||
val positionY = chunkPosition.y
|
val positionY = chunkPosition.y
|
||||||
|
|
||||||
if (directionX <= 0 && (section?.occlusion?.isOccluded(inverted, Directions.WEST) != true) && chunkPosition.x > chunkMin.x) {
|
if (directionX <= 0 && (section?.occlusion?.isOccluded(inverted, Directions.WEST) != true) && positionX > chunkMin.x) {
|
||||||
chunkPosition.x = positionX - 1; chunkPosition.y = positionY // + WEST
|
chunkPosition.x = positionX - 1; chunkPosition.y = positionY // + WEST
|
||||||
val nextChunk = chunk.neighbours[ChunkNeighbours.WEST]
|
val nextChunk = chunk.neighbours[ChunkNeighbours.WEST]
|
||||||
if (nextChunk != null) {
|
if (nextChunk != null) {
|
||||||
@ -266,7 +266,7 @@ class WorldVisibilityGraph(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directionX >= 0 && (section?.occlusion?.isOccluded(inverted, Directions.EAST) != true) && chunkPosition.x < chunkMax.x) {
|
if (directionX >= 0 && (section?.occlusion?.isOccluded(inverted, Directions.EAST) != true) && positionX < chunkMax.x) {
|
||||||
chunkPosition.x = positionX + 1; chunkPosition.y = positionY // + EAST
|
chunkPosition.x = positionX + 1; chunkPosition.y = positionY // + EAST
|
||||||
val nextChunk = chunk.neighbours[ChunkNeighbours.EAST]
|
val nextChunk = chunk.neighbours[ChunkNeighbours.EAST]
|
||||||
if (nextChunk != null) {
|
if (nextChunk != null) {
|
||||||
@ -293,7 +293,7 @@ class WorldVisibilityGraph(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directionZ <= 0 && (section?.occlusion?.isOccluded(inverted, Directions.NORTH) != true) && chunkPosition.y > chunkMin.y) {
|
if (directionZ <= 0 && (section?.occlusion?.isOccluded(inverted, Directions.NORTH) != true) && positionY > chunkMin.y) {
|
||||||
chunkPosition.x = positionX; chunkPosition.y = positionY - 1 // + NORTH
|
chunkPosition.x = positionX; chunkPosition.y = positionY - 1 // + NORTH
|
||||||
val nextChunk = chunk.neighbours[ChunkNeighbours.NORTH]
|
val nextChunk = chunk.neighbours[ChunkNeighbours.NORTH]
|
||||||
if (nextChunk != null) {
|
if (nextChunk != null) {
|
||||||
@ -305,7 +305,7 @@ class WorldVisibilityGraph(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directionZ >= 0 && (section?.occlusion?.isOccluded(inverted, Directions.SOUTH) != true) && chunkPosition.y < chunkMax.y) {
|
if (directionZ >= 0 && (section?.occlusion?.isOccluded(inverted, Directions.SOUTH) != true) && positionY < chunkMax.y) {
|
||||||
chunkPosition.x = positionX; chunkPosition.y = positionY + 1 // + SOUTH
|
chunkPosition.x = positionX; chunkPosition.y = positionY + 1 // + SOUTH
|
||||||
val nextChunk = chunk.neighbours[ChunkNeighbours.SOUTH]
|
val nextChunk = chunk.neighbours[ChunkNeighbours.SOUTH]
|
||||||
if (nextChunk != null) {
|
if (nextChunk != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user