filter cages by whether they are occupied

develop
Myk Taylor 2023-10-15 14:03:31 -07:00
parent 84681f1aa8
commit 682e9d3a86
No known key found for this signature in database
3 changed files with 22 additions and 0 deletions

@ -74,6 +74,7 @@ Template for new versions:
- `orders`: ``recheck`` command now only resets orders that have conditions that can be rechecked
- `sort`: added help button for squad assignment search/filter/sort
- `zone`: animals trained for war or hunting are now labeled as such in animal assignment screens
- `buildingplan`: support filtering cages by whether they are occupied
## Documentation
- unavailable tools are no longer listed in the tag indices in the online docs

@ -119,6 +119,11 @@ bool matchesFilters(df::item * item, const df::job_item * jitem, HeatSafety heat
&& static_cast<df::item_slabst *>(item)->engraving_type != df::slab_engraving_type::Memorial)
return false;
if (item->getType() == df::item_type::CAGE && specials.count("empty")
&& (Items::getGeneralRef(item, df::general_ref_type::CONTAINS_UNIT)
|| Items::getGeneralRef(item, df::general_ref_type::CONTAINS_ITEM)))
return false;
if (!matchesHeatSafety(item->getMaterial(), item->getMaterialIndex(), heat))
return false;

@ -162,6 +162,10 @@ local function is_slab()
return uibs.building_type == df.building_type.Slab
end
local function is_cage()
return uibs.building_type == df.building_type.Cage
end
local function is_stairs()
return is_construction()
and uibs.building_subtype == df.construction_type.UpDownStair
@ -477,6 +481,16 @@ function PlannerOverlay:init()
buildingplan.setSpecial(uibs.building_type, uibs.building_subtype, uibs.custom_type, 'engraved', val)
end,
},
widgets.ToggleHotkeyLabel {
view_id='empty',
frame={b=4, l=1, w=22},
key='CUSTOM_T',
label='Empty only:',
visible=is_cage,
on_change=function(val)
buildingplan.setSpecial(uibs.building_type, uibs.building_subtype, uibs.custom_type, 'empty', val)
end,
},
widgets.Label{
frame={b=4, l=23},
text_pen=COLOR_DARKGREY,
@ -847,6 +861,8 @@ function PlannerOverlay:onRenderFrame(dc, rect)
local buildingplan = require('plugins.buildingplan')
self.subviews.engraved:setOption(buildingplan.getSpecials(
uibs.building_type, uibs.building_subtype, uibs.custom_type).engraved or false)
self.subviews.empty:setOption(buildingplan.getSpecials(
uibs.building_type, uibs.building_subtype, uibs.custom_type).empty or false)
self.subviews.choose:setOption(buildingplan.getChooseItems(
uibs.building_type, uibs.building_subtype, uibs.custom_type))
self.subviews.safety:setOption(buildingplan.getHeatSafetyFilter(