- 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
16 lines
218 B
TOML
16 lines
218 B
TOML
[grass]
|
|
drops = [
|
|
{ prefab = "Coin", chance_pct = 5, min_count = 1, max_count = 2 },
|
|
]
|
|
|
|
[dirt]
|
|
drops = []
|
|
|
|
[rock]
|
|
drops = [
|
|
{ prefab = "Coin", chance_pct = 10, min_count = 1, max_max = 1 },
|
|
]
|
|
|
|
[air]
|
|
drops = []
|