feat: soft entity collision, dead code removal, leaf standability fix

- Add TileOccupancy resource and rebuild_tile_occupancy system to track
  per-tile entity counts for soft collision avoidance
- Add collision_delay to Ambulatory; entities try relative-left step on
  occupied tiles, wait 1 tick, then push through
- Fix leaf canopy standability: leaves are now can_stand_in=true,
  can_stand_on=false (walkable, not standable-on)
- Delete FloorTilePrefab / FixtureTilePrefab / FloorTile / FixtureTile /
  TileState (all fully dead — TileMap + ChunkData are sole truth)
- Delete tile_spawns from TerrainBlob (populated but never consumed)
- Delete leaf ghost entity spawn in forestry (orphaned invisible ECS entity)
- Replace log prefab spawn with inline commands.spawn(Transform, Visibility)
- Add TileMap::remove_fixture for future digging/explosion use
- Skip collision avoidance when current tile has >2 entities (handles spawn
  cluster deadlock)
This commit is contained in:
2026-03-21 01:36:38 +00:00
parent 1fe4781bab
commit 90a6196443
25 changed files with 1909 additions and 498 deletions
+18
View File
@@ -237,6 +237,24 @@ impl TileMap {
.unwrap_or(100)
}
/// Remove a fixture tile, clearing both the HashMap entry and ChunkData bitsets.
/// BOTH must be cleared — leaving ChunkData stale causes is_standable bugs.
pub fn remove_fixture(&mut self, pos: &IVec3) -> Option<FixtureTileData> {
use super::chunk_data::ChunkData;
let removed = self.fixture_tiles.remove(pos);
let chunk_pos = world_to_chunk(*pos);
if let Some(chunk) = self.chunks.get_mut(&chunk_pos) {
let (lx, ly, z) = ChunkData::world_to_local(*pos);
let idx = ChunkData::pos_to_index(lx, ly, z);
let word = idx / 32;
let clear_mask = !(1u32 << (idx % 32));
chunk.stand_in_fixture[word] &= clear_mask;
chunk.stand_on_fixture[word] &= clear_mask;
}
removed
}
/// Remove all tile data for a specific chunk from the TileMap.
/// Iterates all positions in the chunk volume and removes from HashMaps.
/// Used during chunk unloading to clean up tile data.