diff --git a/src/entities/livestock/rabbit.rs b/src/entities/livestock/rabbit.rs index d94e3ce..521e311 100644 --- a/src/entities/livestock/rabbit.rs +++ b/src/entities/livestock/rabbit.rs @@ -134,14 +134,15 @@ pub fn rabbit_dig_system( if tilemap.remove_floor(&below_pos).is_some() { tile_changed.write(TileChangedEvent { pos: below_pos }); - // Refresh visibility for the dug tile and all 26 neighbours. - // Removing a tile changes what is visible from every adjacent position. - for dz in -1..=1i32 { + // Refresh the full column below the dig and its XY neighbours. + // calculate_visibility traces up to Z_TOTAL+Z_BELOW+1 tiles above each tile, + // so removing one tile can affect visibility arbitrarily deep below. + for dz in 0..=crate::world::chunks::Z_BELOW as i32 { for dy in -1..=1i32 { for dx in -1..=1i32 { occlusion.write(TileOcclusionEvent { tile_position: below_pos - + IVec3::new(dx * ITILE_SIZE, dy * ITILE_SIZE, dz * ITILE_SIZE), + - IVec3::new(dx * ITILE_SIZE, dy * ITILE_SIZE, dz * ITILE_SIZE), }); } } diff --git a/src/world/tiles/visibility.rs b/src/world/tiles/visibility.rs index e7d30a7..229f39f 100644 --- a/src/world/tiles/visibility.rs +++ b/src/world/tiles/visibility.rs @@ -144,7 +144,8 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] { ); match tilemap.floor_tiles.get(&neighbor_pos) { Some(tile) if tile.id == 0 => break 'neighbor_check true, - None => {} + // Absent tile means open space — treat as air for visibility. + None => break 'neighbor_check true, _ => {} } }