Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[makeown] cancel hostile jobs #1322

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Template for new versions:
## Fixes
- `gui/quickfort`: only print a help blueprint's text once even if the repeat setting is enabled
- `makeown`: quell any active enemy or conflict relationships with converted creatures
- `makeown`: halt any hostile jobs the unit may be engaged in, like kidnapping
- `fix/loyaltycascade`: allow the fix to work on non-dwarven citizens
- `control-panel`: fix setting numeric preferences from the commandline

Expand Down
13 changes: 13 additions & 0 deletions makeown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ local function sanitize_profession(prof)
return prof_map[prof] or prof
end

local hostile_jobs = utils.invert{
df.job_type.Kidnap,
df.job_type.HeistItem,
df.job_type.AcceptHeistItem,
}

local function cancel_hostile_jobs(job)
if not job or not hostile_jobs[job.job_type] then return end
dfhack.job.removeJob(job)
end

local function fix_unit(unit)
unit.flags1.marauder = false;
unit.flags1.merchant = false;
Expand Down Expand Up @@ -151,6 +162,8 @@ local function fix_unit(unit)
end

clear_enemy_status(unit)

cancel_hostile_jobs(unit.job.current_job)
end

local function add_to_entity(hf, eid)
Expand Down