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)
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::constants::*;
|
||||
use crate::entities::behaviour::{EntityBehaviourRegistry, EntityType};
|
||||
use crate::entities::cargo::{CarryVisualState, HaulSlot};
|
||||
use crate::entities::shared_components::Ambulatory;
|
||||
use crate::entities::tasks::job_queue::JobId;
|
||||
use crate::entities::tasks::{IdleState, Task, TaskQueue, TaskState};
|
||||
use crate::game::SpawnDelay;
|
||||
use crate::world::VisibleGameEntity;
|
||||
@@ -57,6 +58,7 @@ impl Dorf {
|
||||
carry_visual: CarryVisualState::new(normal_sprite, carry_sprite),
|
||||
task_queue: TaskQueue {
|
||||
tasks: VecDeque::from([Task::Idle {
|
||||
job_id: JobId::default(),
|
||||
origin,
|
||||
sigma_world: behaviour.idle.sigma_world,
|
||||
state: IdleState::Picking {
|
||||
|
||||
Reference in New Issue
Block a user