diff --git a/docs/changelog.txt b/docs/changelog.txt index 83fbf8c20..425e570eb 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -60,6 +60,7 @@ Template for new versions: ## Fixes - Core: reload scripts in mods when a world is unloaded and immediately loaded again - Core: fix text getting added to DFHack text entry widgets when Alt- or Ctrl- keys are hit +- `buildingplan`: ensure selected barrels and buckets are empty (or at least free of lye and milk) as per the requirements of the building - `orders`: prevent import/export overlay from appearing on the create workorder screen - `caravan`: corrected prices for cages that have units inside of them - `tailor`: remove crash caused by clothing items with an invalid ``maker_race`` diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index bf4437ef7..983921576 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -420,6 +420,7 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat, xmask1.bits.cookable = true; break; + // TODO: split this into BOX and BAG case BOX: OK(1,bag); OK(1,sand_bearing); OK(1,milk); OK(2,dye); OK(2,plaster_containing); diff --git a/plugins/buildingplan/buildingplan_cycle.cpp b/plugins/buildingplan/buildingplan_cycle.cpp index 45cafe474..f7c23d8ce 100644 --- a/plugins/buildingplan/buildingplan_cycle.cpp +++ b/plugins/buildingplan/buildingplan_cycle.cpp @@ -88,6 +88,20 @@ bool matchesFilters(df::item * item, const df::job_item * job_item, HeatSafety h if (job_item->flags2.bits.building_material && !item->isBuildMat()) return false; + if ((job_item->flags1.bits.empty || job_item->flags2.bits.lye_milk_free)) { + auto gref = Items::getGeneralRef(item, df::general_ref_type::CONTAINS_ITEM); + if (gref) { + if (job_item->flags1.bits.empty) + return false; + if (auto contained_item = gref->getItem(); contained_item) { + MaterialInfo mi; + mi.decode(contained_item); + if (mi.getToken() != "WATER") + return false; + } + } + } + if (job_item->metal_ore > -1 && !item->isMetalOre(job_item->metal_ore)) return false; diff --git a/plugins/lua/buildingplan/planneroverlay.lua b/plugins/lua/buildingplan/planneroverlay.lua index 803e9ae99..643852a6e 100644 --- a/plugins/lua/buildingplan/planneroverlay.lua +++ b/plugins/lua/buildingplan/planneroverlay.lua @@ -775,7 +775,9 @@ function PlannerOverlay:onInput(keys) local filters = get_cur_filters() local num_filters = #filters local choose = self.subviews.choose:getOptionValue() - if choose > 0 then + if choose == 0 then + self:place_building(get_placement_data()) + else local bounds = get_selected_bounds() self:save_placement() local autoselect = choose == 2 @@ -806,7 +808,7 @@ function PlannerOverlay:onInput(keys) end end, on_cancel=function() - for i,scr in pairs(active_screens) do + for _,scr in pairs(active_screens) do scr:dismiss() end df.global.game.main_interface.bottom_mode_selected = df.main_bottom_mode_type.BUILDING_PLACEMENT @@ -820,8 +822,6 @@ function PlannerOverlay:onInput(keys) active_screens[idx] = selection_screen:show() end end - else - self:place_building(get_placement_data()) end return true elseif not is_choosing_area() then