From 640c77dc48f8933eeb06c1efbdd15c07e0a55940 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 9 Oct 2023 17:31:50 -0700 Subject: [PATCH] dungeon cages/retraints aren't assignable --- docs/changelog.txt | 1 + plugins/lua/zone.lua | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index fbe37deff..59868e902 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -60,6 +60,7 @@ Template for new versions: - `sort`: new search widgets for Info panel tabs, including all "Creatures" subtabs, all "Objects" subtabs, "Tasks", the "Work details" subtab under "Labor", and the "Interrogate" and "Convict" screens under "Justice" ## Fixes +- `zone`: don't show animal assignment link for dungeon cages/restraints ## Misc Improvements - `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates diff --git a/plugins/lua/zone.lua b/plugins/lua/zone.lua index 13182cef1..eb984093b 100644 --- a/plugins/lua/zone.lua +++ b/plugins/lua/zone.lua @@ -961,9 +961,13 @@ CageChainOverlay.ATTRS{ local function is_valid_building() local bld = dfhack.gui.getSelectedBuilding(true) - return bld and bld:getBuildStage() == bld:getMaxBuildStage() and - (bld:getType() == df.building_type.Cage or - bld:getType() == df.building_type.Chain) + if not bld or bld:getBuildStage() ~= bld:getMaxBuildStage() then return false end + local bt = bld:getType() + if bt ~= df.building_type.Cage and bt ~= df.building_type.Chain then return false end + for _,zone in ipairs(bld.relations) do + if zone.type == df.civzone_type.Dungeon then return false end + end + return true end local function is_cage_selected()