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:
2026-03-21 12:09:49 +00:00
parent 5357a69930
commit 4d702bc8f5
3 changed files with 57 additions and 10 deletions
+13 -3
View File
@@ -128,9 +128,19 @@ pub fn rabbit_dig_system(
if tilemap.remove_floor(&below_pos).is_some() {
tile_changed.write(TileChangedEvent { pos: below_pos });
occlusion.write(TileOcclusionEvent {
tile_position: 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 {
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),
});
}
}
}
}
}
}