Skip to content

Commit

Permalink
be more selective about which aritifacts and units to list
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed May 12, 2024
1 parent e8666f3 commit 0d7bfa3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gui/sitemap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,22 @@ local function zoom_to_next_zone(_, choice)
end

local function get_unit_choices()
local is_fort = dfhack.world.isFortressMode()
local choices = {}
for _, unit in ipairs(df.global.world.units.active) do
if not dfhack.units.isActive(unit) or
dfhack.units.isHidden(unit) or
(is_fort and not dfhack.maps.isTileVisible(dfhack.units.getPosition(unit)))
then
goto continue
end
table.insert(choices, {
text=dfhack.units.getReadableName(unit),
data={
unit_id=unit.id,
},
})
::continue::
end
return choices
end
Expand All @@ -114,12 +122,14 @@ end
local function get_artifact_choices()
local choices = {}
for _, item in ipairs(df.global.world.items.other.ANY_ARTIFACT) do
if item.flags.garbage_collect then goto continue end
table.insert(choices, {
text=dfhack.items.getReadableDescription(item),
data={
item_id=item.id,
},
})
::continue::
end
return choices
end
Expand All @@ -142,7 +152,7 @@ function Sitemap:init()
widgets.TabBar{
frame={t=0, l=0},
labels={
'People',
'Creatures',
'Locations',
'Artifacts',
},
Expand Down

0 comments on commit 0d7bfa3

Please sign in to comment.