From 3b9d731f71bd49123b09177f877fce99ccda6646 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 6 Apr 2025 14:31:21 -0700 Subject: [PATCH] don't show hover tooltip for hidden creatures --- docs/changelog.txt | 1 + plugins/lua/spectate.lua | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index cd43392b78..e311e6441d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -56,6 +56,7 @@ Template for new versions: ## New Features ## Fixes +- `spectate`: don't show a hover tooltip for hidden units (e.g. invisible snatchers) - `stockpiles`: fix one-off error in item type when importing furniture stockpile settings - `dig-now`: fix cases where boulders/rough gems of incorrect material were being generated when digging through walls - `dig-now`: properly generate ice boulders when digging through ice walls diff --git a/plugins/lua/spectate.lua b/plugins/lua/spectate.lua index fd2f736d0e..8c7e653a7b 100644 --- a/plugins/lua/spectate.lua +++ b/plugins/lua/spectate.lua @@ -345,11 +345,15 @@ local function GetUnitInfoText(unit, settings_group_name) return txt end +local function unit_filter(unit) + return not dfhack.units.isHidden(unit) +end + local function GetHoverText(pos) if not pos then return end local txt = {} - local units = dfhack.units.getUnitsInBox(pos, pos) or {} -- todo: maybe (optionally) use filter parameter here? + local units = dfhack.units.getUnitsInBox(pos, pos, unit_filter) or {} for _,unit in ipairs(units) do local info = GetUnitInfoText(unit, 'hover')