diff --git a/docs/changelog.txt b/docs/changelog.txt index b02403a88c..67f4885dd8 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -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 diff --git a/plugins/lua/buildingplan/filterselection.lua b/plugins/lua/buildingplan/filterselection.lua index 3db58155e0..c6e043d249 100644 --- a/plugins/lua/buildingplan/filterselection.lua +++ b/plugins/lua/buildingplan/filterselection.lua @@ -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) @@ -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',