From f239c68fa60e6498a423ec9408172058ace2df09 Mon Sep 17 00:00:00 2001 From: Myk Date: Sat, 14 Sep 2024 20:24:12 -0700 Subject: [PATCH] Apply suggestions from code review --- changelog.txt | 1 - docs/idle-crafting.rst | 2 +- idle-crafting.lua | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 30ace4473..ae1b4851e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -57,7 +57,6 @@ Template for new versions: - `position`: option to copy keyboard cursor position to the clipboard - `assign-minecarts`: reassign vehicles to routes where the vehicle has been destroyed (or has otherwise gone missing) - `fix/dry-buckets`: prompt DF to recheck requests for aid (e.g. "bring water" jobs) when a bucket is unclogged and becomes available for use -- `idle-crafting`: make choice of crafting job dependent on resources in linked stockpiles. - `exterminate`: show descriptive names for the listed races in addition to their IDs ## Documentation diff --git a/docs/idle-crafting.rst b/docs/idle-crafting.rst index d1cd23c51..5f99d24df 100644 --- a/docs/idle-crafting.rst +++ b/docs/idle-crafting.rst @@ -46,7 +46,7 @@ this way. When a workshop is designated for idle crafting, this tool will create crafting jobs and assign them to idle dwarves who have a need for crafting objects. This -script respects the setting for permitted general work orders from the "Workers" +script respects the setting for permitted general work order labors from the "Workers" tab. For workshops without input stockpile links, bone carving and stonecrafting are diff --git a/idle-crafting.lua b/idle-crafting.lua index 92673f51b..2ccf1d30f 100644 --- a/idle-crafting.lua +++ b/idle-crafting.lua @@ -15,7 +15,7 @@ local function for_inputs(workshop, action) else for _, stockpile in ipairs(workshop.profile.links.take_from_pile) do for _, item in ipairs(dfhack.buildings.getStockpileContents(stockpile)) do - if(item:isAssignedToThisStockpile(stockpile.id)) then + if item:isAssignedToThisStockpile(stockpile.id) then for _, contained_item in ipairs(dfhack.items.getContainedItems(item)) do action(contained_item) end @@ -25,7 +25,7 @@ local function for_inputs(workshop, action) end end for _, contained_item in ipairs(workshop.contained_items) do - if contained_item.use_mode == 0 then + if contained_item.use_mode == df.building_item_role_type.TEMP then action(contained_item.item) end end