From 3ed16306da2d419ff6543405d04ebed87f73974a Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 15 Oct 2023 15:21:07 -0700 Subject: [PATCH] mercenaries aren't appointed officials --- docs/changelog.txt | 1 + plugins/lua/sort.lua | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 2bb24e361..1e2690456 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -67,6 +67,7 @@ Template for new versions: ## Fixes - `zone`: races without specific child or baby names will now get generic child/baby names instead of an empty string - `zone`: don't show animal assignment link for cages and restraints linked to dungeon zones (which aren't normally assignable) +- `sort`: don't count mercenaries as appointed officials in the squad assignment screen - `dwarfvet`: fix invalid job id assigned to ``Rest`` job, which could cause crashes on reload ## Misc Improvements diff --git a/plugins/lua/sort.lua b/plugins/lua/sort.lua index 8f89e54e3..b27049e91 100644 --- a/plugins/lua/sort.lua +++ b/plugins/lua/sort.lua @@ -978,7 +978,11 @@ local function is_in_military(unit) end local function is_elected_or_appointed_official(unit) - if #unit.occupations > 0 then return true end + for _,occupation in ipairs(unit.occupations) do + if occupation.type ~= df.occupation_type.MERCENARY then + return true + end + end for _, noble_pos in ipairs(dfhack.units.getNoblePositions(unit) or {}) do if noble_pos.position.flags.ELECTED or (noble_pos.position.mandate_max == 0 and noble_pos.position.demand_max == 0)