Merge pull request #3726 from myk002/myk_buckets

[buildingplan] handle empty and lye_milk_free flags
develop
Myk 2023-09-03 10:33:52 -07:00 committed by GitHub
commit b2e31e76eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

@ -60,6 +60,7 @@ Template for new versions:
## Fixes ## Fixes
- Core: reload scripts in mods when a world is unloaded and immediately loaded again - 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 - 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 - `orders`: prevent import/export overlay from appearing on the create workorder screen
- `caravan`: corrected prices for cages that have units inside of them - `caravan`: corrected prices for cages that have units inside of them
- `tailor`: remove crash caused by clothing items with an invalid ``maker_race`` - `tailor`: remove crash caused by clothing items with an invalid ``maker_race``

@ -420,6 +420,7 @@ bool ItemTypeInfo::matches(const df::job_item &item, MaterialInfo *mat,
xmask1.bits.cookable = true; xmask1.bits.cookable = true;
break; break;
// TODO: split this into BOX and BAG
case BOX: case BOX:
OK(1,bag); OK(1,sand_bearing); OK(1,milk); OK(1,bag); OK(1,sand_bearing); OK(1,milk);
OK(2,dye); OK(2,plaster_containing); OK(2,dye); OK(2,plaster_containing);

@ -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()) if (job_item->flags2.bits.building_material && !item->isBuildMat())
return false; 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)) if (job_item->metal_ore > -1 && !item->isMetalOre(job_item->metal_ore))
return false; return false;

@ -775,7 +775,9 @@ function PlannerOverlay:onInput(keys)
local filters = get_cur_filters() local filters = get_cur_filters()
local num_filters = #filters local num_filters = #filters
local choose = self.subviews.choose:getOptionValue() 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() local bounds = get_selected_bounds()
self:save_placement() self:save_placement()
local autoselect = choose == 2 local autoselect = choose == 2
@ -806,7 +808,7 @@ function PlannerOverlay:onInput(keys)
end end
end, end,
on_cancel=function() on_cancel=function()
for i,scr in pairs(active_screens) do for _,scr in pairs(active_screens) do
scr:dismiss() scr:dismiss()
end end
df.global.game.main_interface.bottom_mode_selected = df.main_bottom_mode_type.BUILDING_PLACEMENT 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() active_screens[idx] = selection_screen:show()
end end
end end
else
self:place_building(get_placement_data())
end end
return true return true
elseif not is_choosing_area() then elseif not is_choosing_area() then