Skip to content

Commit 085c03e

Browse files
committed
cancel hostile jobs when makeown'd
1 parent 117a1e9 commit 085c03e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Template for new versions:
3535
## Fixes
3636
- `gui/quickfort`: only print a help blueprint's text once even if the repeat setting is enabled
3737
- `makeown`: quell any active enemy or conflict relationships with converted creatures
38+
- `makeown`: halt any hostile jobs the unit may be engaged in, like kidnapping
3839
- `fix/loyaltycascade`: allow the fix to work on non-dwarven citizens
3940
- `control-panel`: fix setting numeric preferences from the commandline
4041

makeown.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ local function sanitize_profession(prof)
100100
return prof_map[prof] or prof
101101
end
102102

103+
local hostile_jobs = utils.invert{
104+
df.job_type.Kidnap,
105+
df.job_type.HeistItem,
106+
df.job_type.AcceptHeistItem,
107+
}
108+
109+
local function cancel_hostile_jobs(job)
110+
if not job or not hostile_jobs[job.job_type] then return end
111+
dfhack.job.removeJob(job)
112+
end
113+
103114
local function fix_unit(unit)
104115
unit.flags1.marauder = false;
105116
unit.flags1.merchant = false;
@@ -151,6 +162,8 @@ local function fix_unit(unit)
151162
end
152163

153164
clear_enemy_status(unit)
165+
166+
cancel_hostile_jobs(unit.job.current_job)
154167
end
155168

156169
local function add_to_entity(hf, eid)

0 commit comments

Comments
 (0)