Skip to content

Commit

Permalink
mercenaries aren't appointed officials
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Oct 15, 2023
1 parent 754a4fb commit 3ed1630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion plugins/lua/sort.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3ed1630

Please sign in to comment.