properly initialize job id when linking into world

develop
Myk Taylor 2023-10-13 23:30:09 -07:00
parent 30cc6e6e8e
commit cd935dcdcb
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

@ -65,6 +65,7 @@ Template for new versions:
## Fixes ## Fixes
- `zone`: don't show animal assignment link for cages and restraints linked to dungeon zones (which aren't normally assignable) - `zone`: don't show animal assignment link for cages and restraints linked to dungeon zones (which aren't normally assignable)
- `dwarfvet`: fix invalid job id assigned to ``Rest`` job, which could cause crashes on reload
## Misc Improvements ## Misc Improvements
- `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates - `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates

@ -92,13 +92,12 @@ function HospitalZone:assign_spot(unit, unit_pos)
local pos = self:find_spot(unit_pos) local pos = self:find_spot(unit_pos)
if not pos then return false end if not pos then return false end
local job = df.new(df.job) local job = df.new(df.job)
dfhack.job.linkIntoWorld(job) dfhack.job.linkIntoWorld(job, true)
job.pos.x = pos.x job.pos.x = pos.x
job.pos.y = pos.y job.pos.y = pos.y
job.pos.z = pos.z job.pos.z = pos.z
job.flags.special = true job.flags.special = true
job.job_type = df.job_type.Rest job.job_type = df.job_type.Rest
job.wait_timer = 1600
local gref = df.new(df.general_ref_unit_workerst) local gref = df.new(df.general_ref_unit_workerst)
gref.unit_id = unit.id gref.unit_id = unit.id
job.general_refs:insert('#', gref) job.general_refs:insert('#', gref)