diff --git a/docs/changelog.txt b/docs/changelog.txt index 6731727ba9..46178ecb20 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -82,6 +82,7 @@ Template for new versions: - `sort`: add "Toggle all filters" hotkey button to the squad assignment panel - `sort`: rename "Weak mental fortitude" filter to "Dislikes combat", which should be more understandable - Dreamfort: put more chairs adjacent to each other to make the tavern more "social" +- `zone`: show geld status and custom profession (2nd editable line in creature description) in pasture/pit/cage/restraint assignment screen ## Documentation - `installing`: Add installation instructions for wineskin on Mac diff --git a/plugins/lua/zone.lua b/plugins/lua/zone.lua index b82ac72e77..93271ba49b 100644 --- a/plugins/lua/zone.lua +++ b/plugins/lua/zone.lua @@ -87,14 +87,24 @@ end local function sort_by_gender_desc(a, b) if a.data.gender == b.data.gender then - return sort_by_race_desc(a, b) + local ag = a.data.gelded or false + local bg = b.data.gelded or false + if ag == bg then + return sort_by_race_desc(a, b) + end + return bg end return a.data.gender < b.data.gender end local function sort_by_gender_asc(a, b) if a.data.gender == b.data.gender then - return sort_by_race_desc(a, b) + local ag = a.data.gelded or false + local bg = b.data.gelded or false + if ag == bg then + return sort_by_race_desc(a, b) + end + return ag end return a.data.gender > b.data.gender end @@ -447,6 +457,7 @@ function AssignAnimal:make_choice_text(data) elseif data.gender == df.pronoun_type.he then gender_ch = CH_MALE end + gender_ch = string.format(data.gelded and 'x%sx' or ' %s ', gender_ch) return { {width=STATUS_COL_WIDTH, text=function() return self.status[self.status_revmap[data.status]].label end}, {gap=2, width=DISPOSITION_COL_WIDTH, text=function() return DISPOSITION[DISPOSITION_REVMAP[data.disposition]].label end}, @@ -562,9 +573,13 @@ function AssignAnimal:cache_choices() for _, unit in ipairs(df.global.world.units.active) do if not is_assignable_unit(unit) then goto continue end local raw = df.creature_raw.find(unit.race) + local desc = dfhack.units.getReadableName(unit) + if #unit.custom_profession > 0 then + desc = unit.custom_profession .. ', ' .. desc + end local data = { unit=unit, - desc=dfhack.units.getReadableName(unit), + desc=desc, gender=unit.sex, race=raw and raw.creature_id or '', status=self.get_status(unit, bld_assignments), @@ -572,6 +587,7 @@ function AssignAnimal:cache_choices() egg=dfhack.units.isEggLayerRace(unit), graze=dfhack.units.isGrazer(unit), juvenile=not dfhack.units.isAdult(unit), + gelded=dfhack.units.isGelded(unit), } local choice = { search_key=make_search_key(data.desc, raw),