From cd935dcdcbaf34f081a2c348c26119cc603cb136 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 13 Oct 2023 23:30:09 -0700 Subject: [PATCH] properly initialize job id when linking into world --- docs/changelog.txt | 1 + plugins/lua/dwarfvet.lua | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 5d83dc4cf..017d61645 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -65,6 +65,7 @@ Template for new versions: ## Fixes - `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 - `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates diff --git a/plugins/lua/dwarfvet.lua b/plugins/lua/dwarfvet.lua index a976b91c8..2bda976b7 100644 --- a/plugins/lua/dwarfvet.lua +++ b/plugins/lua/dwarfvet.lua @@ -92,13 +92,12 @@ function HospitalZone:assign_spot(unit, unit_pos) local pos = self:find_spot(unit_pos) if not pos then return false end local job = df.new(df.job) - dfhack.job.linkIntoWorld(job) + dfhack.job.linkIntoWorld(job, true) job.pos.x = pos.x job.pos.y = pos.y job.pos.z = pos.z job.flags.special = true job.job_type = df.job_type.Rest - job.wait_timer = 1600 local gref = df.new(df.general_ref_unit_workerst) gref.unit_id = unit.id job.general_refs:insert('#', gref)