Skip to content

Commit ff447d4

Browse files
authored
don't overcount units for misery widget
addendum to DFHack#2366
1 parent 152aa70 commit ff447d4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

plugins/lua/dwarfmonitor.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ end
116116
function MiseryWidget:overlay_onupdate()
117117
local counts, num_colors = {}, #self.colors
118118
for _,unit in ipairs(df.global.world.units.active) do
119+
if not dfhack.units.isCitizen(unit, true) then goto continue end
119120
local stress_category = math.min(num_colors,
120121
dfhack.units.getStressCategory(unit))
121122
counts[stress_category] = (counts[stress_category] or 0) + 1
123+
::continue::
122124
end
123125

124126
local width = 2 + num_colors - 1 -- 'H:' plus the slashes

0 commit comments

Comments
 (0)