fix: rabbit dig occlusion refresh, bounds guard panic, world floor clamp
- Fire TileOcclusionEvent for 27-tile neighbourhood (3x3x3) so tiles above the dug tile recalculate visibility and stop rendering black - Clamp gravity in movement to world minimum z — rabbits digging the floor below them now stop at world floor instead of falling past it - Assert bounds in remove_floor/remove_fixture before pos_to_index to panic with z/coords info instead of silently overflowing - Hoist ITILE_SIZE, CHUNK_SIZE, Z_BELOW, Z_ABOVE to module-level imports in tilemap.rs
This commit is contained in:
@@ -609,7 +609,12 @@ pub fn movement(
|
||||
.for_each(|(mut ambulatory, mut transform)| {
|
||||
let current_pos = transform.translation;
|
||||
if !is_standable_tile(&tilemap, current_pos.as_ivec3()) {
|
||||
transform.translation.z -= TILE_SIZE;
|
||||
// Don't fall below world minimum z — rabbits digging can leave no floor
|
||||
// to stand on, but they should stop at the world floor rather than
|
||||
// falling into oblivion and panicking pos_to_index overflow.
|
||||
if transform.translation.z > -(crate::world::chunks::Z_BELOW as f32) * TILE_SIZE {
|
||||
transform.translation.z -= TILE_SIZE;
|
||||
}
|
||||
ambulatory.current_path = None;
|
||||
ambulatory.target = None;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user