Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zone] dungeon cages/restraints aren't assignable #3860

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions plugins/lua/zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down