Commit Graph
191 Commits
Author SHA1 Message Date
popertots 3c74a68d4d Refactor job queue: add JobState enum, improve pathfinding fallback
- Add JobState enum (Unclaimed, Claimed, Complete) replacing boolean claimed flag
- Increase provisional node limit from 256 to 4096
- Add iter_unclaimed() and claim_job_at() methods to JobQueue
- Update job_assignment to filter idle dorfs, match by distance
- Add unclaim_jobs_for_entity() for handling dorf death/failure
- Add JobId collision detection in debug builds
- Fix demo system to check Pending state for chopping dorfs
- Throttle queue_debug to every 120 ticks
- Add surface position deduplication for terrain chunks
2026-03-29 13:02:05 +01:00
popertots 79e0efa409 Fix job queueing system: add JobId tracking for failed job reassignment
- Add JobId (rolling u16 counter) to track jobs through their lifecycle
- Add job_id field to all Task variants (Idle, GoTo, ChopTree, HaulCargo, DropHauled)
- Add unclaim_job() method to requeue failed jobs for reassignment
- Change task failure paths to use unclaim_job() instead of complete_job_by_id()
  - This allows failed jobs to be picked up by another dorf instead of being stuck
- Add to_job_kind() and get_job_id() helper methods to Task
- Fix pathfinding is_standable_tile debug logging spam
- Fix chunk bounds check in ChunkData::is_standable (was checking wrong z range)
2026-03-27 20:28:58 +00:00
popertots bd1b45e4d7 attempt 3 2026-03-27 10:29:33 +00:00
popertots 1f5dfe5182 Task fix attempt 2026-03-23 19:31:30 +00:00
popertots 3632836016 fix 2026-03-22 22:30:15 +00:00
popertots bf81f42ced fix 2026-03-22 22:10:00 +00:00
popertots 57764fbcbb fix 2026-03-22 22:05:08 +00:00
popertots c448ef4bff fix 2026-03-22 22:01:11 +00:00
popertots 760f6602cf fix 2026-03-22 16:51:20 +00:00
popertots ffb0e79cf3 fix 2026-03-22 16:45:46 +00:00
popertots 738f595f67 debug 2026-03-22 16:38:54 +00:00
popertots e7a43457a3 fix 2026-03-22 16:05:38 +00:00
popertots bceec18a7a log sprite 2026-03-22 16:05:33 +00:00
popertots c46e23af06 fix 2026-03-22 15:23:44 +00:00
popertots 3b9b2d9c88 fix 2026-03-22 15:07:05 +00:00
popertots 5a830f46f9 demo part 2 2026-03-22 14:57:59 +00:00
popertots 54eabe85e2 fix 2026-03-22 14:34:59 +00:00
popertots 57e377c093 fix 2026-03-22 13:01:10 +00:00
popertots 2eaf0196a5 demo 1 2026-03-22 12:56:52 +00:00
popertots 360ffc7526 value tweaks 2026-03-22 12:06:33 +00:00
popertots 26a861e1a5 value tweaks 2026-03-22 12:00:17 +00:00
popertots cb5b18008d fix 2026-03-22 11:50:53 +00:00
popertots 2f456f80b8 Gaussian idle 2026-03-22 11:29:50 +00:00
popertots b2dc0cb864 fix 2026-03-22 11:02:36 +00:00
popertots 749913a028 fix? 2026-03-22 01:58:34 +00:00
popertots adc236dc3d fix 2026-03-22 01:52:20 +00:00
popertots 9afcb0f612 more debug 2026-03-22 01:32:22 +00:00
popertots 64a69d6a40 Debug 2026-03-22 01:24:08 +00:00
popertots deb3f741b0 rng fix 2026-03-22 01:00:42 +00:00
popertots 71653350d8 fix 2026-03-22 00:52:06 +00:00
popertots cafe376841 Plugin cleanup 2026-03-22 00:43:03 +00:00
popertots d61baaf1ba Task Infrastructure — Task Enum, Queue, Events, Executor 2026-03-22 00:35:22 +00:00
popertots 458068fb87 run_if 2026-03-22 00:03:57 +00:00
popertots ff149117ca remove Digger from dorf 2026-03-21 23:56:03 +00:00
popertots 029e4162d8 fixes 2026-03-21 23:48:49 +00:00
popertots c776b91a44 haulage system WIP 2026-03-21 23:39:58 +00:00
popertots dcdfb375f0 Fix 2026-03-21 21:51:29 +00:00
popertots f52c8ab18c inventory: early return before HashSet alloc, restore doc comments 2026-03-21 21:44:06 +00:00
popertots b7b7af5560 inventory: linter fixes - saturating_add, SmallVec<4>, new_default, drop PIG_SLOTS 2026-03-21 21:39:52 +00:00
popertots 2f9360c8bc inv update 2026-03-21 21:27:26 +00:00
popertots 40b5d8ce95 Fix forrestry 2026-03-21 19:20:57 +00:00
popertots 1ddcb538df tree felling optimisations 2026-03-21 19:14:14 +00:00
popertots 4fc4843ed7 fix 2026-03-21 19:10:04 +00:00
popertots 03c3e5d6d7 first pass at tree interaction 2026-03-21 18:57:15 +00:00
popertots cabe944f1b use constants better 2026-03-21 17:51:05 +00:00
popertots f96c71b61b docs: update README architecture diagram with magic_numbers locations 2026-03-21 17:31:57 +00:00
popertots 7fe33d4b2d refactor: split magic_numbers into per-module files
Extracted all doc-commented magic numbers into module-local magic_numbers.rs
files, co-located with the module that owns them. No logic changes.

- entities/shared_systems/magic_numbers: pathfinding + dig constants
- world/generation/terrain/magic_numbers: terrain + cave constants
- world/generation/forestry/magic_numbers: tree constants
- world/tiles/magic_numbers: A*, benchmark, memory constants
- entities/item/magic_numbers: item sprite z-offset
- Removed src/magic_numbers.rs (central file deleted)

Constants imported as `crate::{module}::magic_numbers::*` from each
consumer. src/constants.rs retains only structural constants (PIXEL_RATIO,
TILE_SIZE, SEED, pathfinding tier thresholds).
2026-03-21 17:31:39 +00:00
popertots 776d3caefc fix: dig_rng sequential multiply-add mixing
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.
2026-03-21 17:10:52 +00:00
popertots 2622144cdf fixed typo 2026-03-21 17:09:32 +00:00
popertots 5b563bad67 perf: SmallVec inline storage, TOML drop tables, seeded deterministic RNG
- 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
2026-03-21 16:06:41 +00:00