Skip to content

Commit

Permalink
Merge pull request #4381 from chdoc/filterselection
Browse files Browse the repository at this point in the history
[buildingplan] persist hiding of unavailable materials between invocations.
  • Loading branch information
myk002 authored Mar 17, 2024
2 parents 70629db + 369de0e commit 79f4747
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Template for new versions:
- `dwarfvet`: automatically unassign animals from pastures when they need treatment so they can make their way to the hospital. reassign them to their original pasture when treatment is complete.
- `dwarfvet`: ignore animals assigned to cages or restraints
- Many tools that previously only worked for citizens or only for dwarves now work for all citizens and residents, e.g. `fastdwarf`, `rejuvenate`, etc.
- `buildingplan`: persist hiding of unavailable materials between filterselection invocations

## Documentation
- `overlay-dev-guide`: updated examples and troubleshooting steps
Expand Down
10 changes: 8 additions & 2 deletions plugins/lua/buildingplan/filterselection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ local widgets = require('gui.widgets')
local uibs = df.global.buildreq
local to_pen = dfhack.pen.parse

-- persist hiding of unavailable materials between invocations
hide_unavailable = hide_unavailable or false

local function get_cur_filters()
return dfhack.buildings.getFiltersByType({}, uibs.building_type,
uibs.building_subtype, uibs.custom_type)
Expand Down Expand Up @@ -88,8 +91,11 @@ function QualityAndMaterialsPage:init()
frame={l=0, t=4, w=24},
label='Hide unavailable:',
key='CUSTOM_SHIFT_H',
initial_option=false,
on_change=function() self.dirty = true end,
initial_option=hide_unavailabe,
on_change=function(new,old)
hide_unavailabe = new
self.dirty = true
end,
},
widgets.EditField{
view_id='search',
Expand Down

0 comments on commit 79f4747

Please sign in to comment.