diff --git a/NEWS b/NEWS index 32181f16a..51321be95 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ DFHack future - code for deducing job outputs rewritten in lua for flexibility. - logic fix: collecting webs produces silk, and ungathered webs are not thread. - items assigned to squads are considered busy, even if not in inventory. + - shearing and milking jobs are supported, but only with generic MILK or YARN outputs. New Fix Armory plugin: Together with a couple of binary patches and the gui/assign-rack script, this plugin makes weapon racks, armor stands, chests and cabinets in diff --git a/library/modules/Job.cpp b/library/modules/Job.cpp index def3b4192..757000885 100644 --- a/library/modules/Job.cpp +++ b/library/modules/Job.cpp @@ -75,7 +75,7 @@ df::job *DFHack::Job::cloneJobStruct(df::job *job) { df::general_ref *ref = pnew->references[i]; - if (virtual_cast(ref)) + if (virtual_cast(ref)) vector_erase_at(pnew->references, i); else pnew->references[i] = ref->clone(); diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 7c06aeb4c..4da484ade 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -425,6 +425,8 @@ bool MaterialInfo::matches(const df::dfhack_material_category &cat) TEST(glass, IS_GLASS); if (cat.bits.clay && linear_index(material->reaction_product.id, std::string("FIRED_MAT")) >= 0) return true; + if (cat.bits.milk && linear_index(material->reaction_product.id, std::string("CHEESE_MAT")) >= 0) + return true; return false; } diff --git a/library/xml b/library/xml index 4ab899319..02e0e0d7b 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 4ab899319014d950214714a48cd3049a4beb5eb5 +Subproject commit 02e0e0d7b9a7ef708a621ef5511a24bf8657b4a2 diff --git a/plugins/lua/workflow.lua b/plugins/lua/workflow.lua index 4c011b24c..c3dbe20d9 100644 --- a/plugins/lua/workflow.lua +++ b/plugins/lua/workflow.lua @@ -301,15 +301,26 @@ function listWeakenedConstraints(outputs) local mask = cons.mat_mask if (cons.mat_type or -1) >= 0 then cons.mat_mask = nil + local info = dfhack.matinfo.decode(cons) + if info then + for i,flag in ipairs(df.dfhack_material_category) do + if flag and flag ~= 'wood2' and info:matches{[flag]=true} then + mask = mask or {} + mask[flag] = true + end + end + end end register(cons) if mask then - table.insert(generic, { - item_type = cons.item_type, - item_subtype = cons.item_subtype, - is_craft = cons.is_craft, - mat_mask = mask - }) + for k,v in pairs(mask) do + table.insert(generic, { + item_type = cons.item_type, + item_subtype = cons.item_subtype, + is_craft = cons.is_craft, + mat_mask = { [k] = v } + }) + end end table.insert(anymat, { item_type = cons.item_type, diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 5347d4671..c89d87333 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -377,7 +377,9 @@ static bool isSupportedJob(df::job *job) Job::getHolder(job) && (!job->job_items.empty() || job->job_type == job_type::CollectClay || - job->job_type == job_type::CollectSand); + job->job_type == job_type::CollectSand || + job->job_type == job_type::MilkCreature || + job->job_type == job_type::ShearCreature); } static bool isOptionEnabled(unsigned flag) diff --git a/scripts/gui/workflow.lua b/scripts/gui/workflow.lua index 8dc958062..366e3ec91 100644 --- a/scripts/gui/workflow.lua +++ b/scripts/gui/workflow.lua @@ -306,7 +306,7 @@ function JobConstraints:onNewConstraint() end dlg.showListPrompt( - 'Job Outputs', + 'New limit', 'Select one of the possible outputs:', COLOR_WHITE, choices,