From ff447d46bd2fdca95ea2fa3cdf55344d20bb331e Mon Sep 17 00:00:00 2001 From: Myk Date: Sun, 20 Nov 2022 09:45:23 -0800 Subject: [PATCH] don't overcount units for misery widget addendum to #2366 --- plugins/lua/dwarfmonitor.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/lua/dwarfmonitor.lua b/plugins/lua/dwarfmonitor.lua index e8c07cac6..5358e4289 100644 --- a/plugins/lua/dwarfmonitor.lua +++ b/plugins/lua/dwarfmonitor.lua @@ -116,9 +116,11 @@ end function MiseryWidget:overlay_onupdate() local counts, num_colors = {}, #self.colors for _,unit in ipairs(df.global.world.units.active) do + if not dfhack.units.isCitizen(unit, true) then goto continue end local stress_category = math.min(num_colors, dfhack.units.getStressCategory(unit)) counts[stress_category] = (counts[stress_category] or 0) + 1 + ::continue:: end local width = 2 + num_colors - 1 -- 'H:' plus the slashes