Switch from add-then-XOR pattern to proper sequential multiply-add
avalanche. Each coordinate feeds into the next multiply, preventing
correlation between adjacent tiles when rare drops are introduced.
- SmallVec<[DropEntry; 2]> replaces Vec in DropTable: zero heap allocation for
all current tiles (0 or 1 entries), spills to heap only at 3+
- DropEntry fields packed to u8 (chance_pct, min_count, max_count): ~12 bytes ->
4 bytes; derives Copy so no extra clones
- Replaced SystemTime pseudo-RNG with dig_rng(pos): PCG-style hash of world SEED
+ tile position. Deterministic per world, same dig = same roll every time
- TOML-driven drop tables: assets/drop_tables.toml (grass=5%/1-2, rock=10%/1,
dirt/air=none). TOML parsed at startup into DropTableRegistry resource
- OnceLock global map for async terrain generation tasks to access drop tables
without Bevy resource borrowing
- terrain.rs: DropTableRegistry::global_get("tile") replaces hardcoded drop_table_for
- Add generic digging + drop tables to implemented list
- Rabbit digging: now using Digger component, not debug code
- Building and construction: updated to reflect generic system in place
- Architecture: added digging to shared_systems, drop_table to tiles
- New src/entities/item/drop_table.rs: DropEntry (chance, min/max count,
pseudo-RNG roll) + DropTable wrapper. grass=5% coin 1-2, rock=10% coin 1,
dirt/air=none.
- New src/entities/shared_systems/digging.rs: Digger component + dig_system.
Any entity with Digger digs the tile below on its interval. Replaces
rabbit_dig_system/rabbit_fall_debug_system/RabbitDigTimer/RabbitFallDebug.
- New TileMap::dig_floor: remove_floor + insert air. Used by dig_system.
- FloorTileData: added drop_table field. Lost Copy derive (Vec field).
Updated all 6 terrain.rs call sites with per-tile drop tables.
- Pig: removed PigDropTimer + pig_drop_system. Drops were debug placeholder.
TODO added for future loot-on-death/butcher system.
- Rabbit: removed all debug components/systems. Now uses Digger::new(5.0).
- main.rs: removed rabbit_dig_system/rabbit_fall_debug_system/pig_drop_system,
added shared_systems::digging::dig_system.
- TileMap::insert_floor now syncs ChunkData bits (set_floor_tile) so is_standable
returns correct values for tiles inserted via insert_floor. Previously the
HashMap was updated but ChunkData remained stale, causing is_standable to
return false for valid tiles.
- rabbit_dig_system inserts air tile at the dug position after remove_floor.
Without this, the HashMap entry is absent and ChunkData bits stay 0 (both
false), making is_standable return false at that position. The entity then
falls through multiple levels. Air's can_stand_in=true means the space is
passable — the entity falls through it and lands on solid ground below.
Clearing stand_in_floor when removing a floor tile made the dug position
impassable. An entity falling into the dug slot found (false || false) && true
= false and kept falling. Now only stand_on_floor is cleared — the space
reverts to air (passable), and only the tile above loses its platform.
- calculate_visibility: None from floor_tiles.get() now checks tilemap.chunks
to confirm the neighbour's chunk is loaded before treating it as air.
Without this, unloaded world borders and pending chunks were incorrectly
seen as open space, causing underground tiles to render as black.
- rabbit_dig_system: skip and reset timer when entity is not on standable
ground, preventing rapid-dig cascade as rabbit falls through multiple levels.