Merge pull request #3886 from myk002/myk_squad

[sort] don't count mercenaries as appointed officials
develop
Myk 2023-10-15 16:14:47 -07:00 committed by GitHub
commit 1402cb9da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

@ -67,6 +67,7 @@ Template for new versions:
## Fixes ## Fixes
- `zone`: races without specific child or baby names will now get generic child/baby names instead of an empty string - `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) - `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 - `dwarfvet`: fix invalid job id assigned to ``Rest`` job, which could cause crashes on reload
## Misc Improvements ## Misc Improvements

@ -978,7 +978,11 @@ local function is_in_military(unit)
end end
local function is_elected_or_appointed_official(unit) 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 for _, noble_pos in ipairs(dfhack.units.getNoblePositions(unit) or {}) do
if noble_pos.position.flags.ELECTED or if noble_pos.position.flags.ELECTED or
(noble_pos.position.mandate_max == 0 and noble_pos.position.demand_max == 0) (noble_pos.position.mandate_max == 0 and noble_pos.position.demand_max == 0)