Job system¶
Folder structure¶
| Path | Contents |
|---|---|
jobs/base/ |
AbstractJob, AbstractJobOrderJob |
jobs/need/ |
NeedFullfilmentJob, SleepJob, DrinkJob |
jobs/order/ |
ChopJob, MineJob |
jobs/haul/ |
HaulJob |
JobQueue.ts, Job.ts, index.ts |
Queue, deprecated Job type, re-exports |
Flow¶
- Pending jobs – created by orders (chop, mine, area selection), haul creator, need scheduler
- Assignment – JobAssigner scores free colonists, assigns best match, sets path
- Movement – JobMovement ticks: colonists step along path; step time =
MOVE_INTERVAL_MS / speedFactor - Work – JobWorkExecution: chop/mine via ActionExecutor (async); drink/sleep via tick
- Completion – remove job, update state, onJobComplete (e.g. haul from gather)
- Cancel – user can cancel the current job from the citizen panel (Jobs tab).
JobSystem.cancelJob(jobId)removes the job and clears its path; colonist'scurrentJobIdis cleared. All job types (including drink and sleep) are cancellable. - Force need jobs – "Go drink" / "Go sleep" in the Needs tab cancel any current job, then add a DrinkJob or SleepJob for that colonist. JobAssigner assigns need jobs in the queue even when
DEBUG_HAUL_ONLYis set.
Job types¶
| Type | Target | Dest | Created by |
|---|---|---|---|
| ChopJob | tree | – | Area selection, order click |
| MineJob | stone_chunk | – | Area selection, order click |
| HaulJob | wood_log/stone_brick | storage zone | HaulJobCreator (after gather, orphan scan) |
| DrinkJob | – | water-adjacent tile | NeedJobScheduler (event-driven) |
| SleepJob | – | sleeping zone or current tile | NeedJobScheduler (event-driven) |
XP and skills¶
- Chop → Woodworking; Mine → Mining
- XP = 1 per 0.1s (actual elapsed time from start to completion)
- Level-up when total XP ≥ threshold for next level