mercenaries aren't appointed officials

develop
Myk Taylor 2023-10-15 15:21:07 -07:00
parent 754a4fb3f5
commit 3ed16306da
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

@ -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

@ -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)