diff --git a/NEWS b/NEWS index b4712c22d..fc9266401 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,9 @@ DFHack future - gui/guide-path: displays the cached path for minecart Guide orders. - gui/workshop-job: displays inputs of a workshop job and allows tweaking them. - gui/workflow: a front-end for the workflow plugin. + Workflow plugin: + - properly considers minecarts assigned to routes busy. + - code for deducing job outputs rewritten in lua for flexibility. DFHack v0.34.11-r2 diff --git a/scripts/gui/workflow.lua b/scripts/gui/workflow.lua index b0a01a37c..8dc958062 100644 --- a/scripts/gui/workflow.lua +++ b/scripts/gui/workflow.lua @@ -9,26 +9,26 @@ local dlg = require 'gui.dialogs' local workflow = require 'plugins.workflow' -function check_enabled(cb,...) +function check_enabled(cb) if workflow.isEnabled() then - return cb(...) + return cb() else dlg.showYesNoPrompt( 'Enable Plugin', - { 'The workflow plugin is not enabled currently.', NEWLINE, NEWLINE + { 'The workflow plugin is not enabled currently.', NEWLINE, NEWLINE, 'Press ', { key = 'MENU_CONFIRM' }, ' to enable it.' }, COLOR_YELLOW, - curry(function(...) + function() workflow.setEnabled(true) - return cb(...) - end,...) + return cb() + end ) end end function check_repeat(job, cb) if job.flags['repeat'] then - return cb(job) + return cb() else dlg.showYesNoPrompt( 'Not Repeat Job', @@ -37,7 +37,7 @@ function check_repeat(job, cb) COLOR_YELLOW, function() job.flags['repeat'] = true - return cb(job) + return cb() end ) end @@ -188,7 +188,7 @@ function JobConstraints:initListChoices(clist, sel_token) if cons.request == 'resume' then order_pen = COLOR_GREEN elseif cons.request == 'suspend' then - order_pen = COLOR_RED + order_pen = COLOR_BLUE end local itemstr = describe_item_type(cons) if cons.min_quality > 0 then @@ -343,9 +343,10 @@ if not string.match(dfhack.gui.getCurFocus(), '^dwarfmode/QueryBuilding/Some/Wor qerror("This script requires a workshop job selected in the 'q' mode") end +local job = dfhack.gui.getSelectedJob() + check_enabled(function() - local job = dfhack.gui.getSelectedJob() - check_repeat(job, function(job) + check_repeat(job, function() local clist = workflow.listConstraints(job) if not clist then dlg.showMessage('Not Supported', 'This type of job is not supported by workflow.', COLOR_LIGHTRED)