Skip to content

Commit

Permalink
Merge pull request DFHack#716 from myk002/myk_orders
Browse files Browse the repository at this point in the history
[quickfort] reinstate orders generation using code borrowed from stockflow
  • Loading branch information
myk002 authored May 26, 2023
2 parents 4393568 + 71264d9 commit a26e72b
Show file tree
Hide file tree
Showing 5 changed files with 654 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ that repo.
## Misc Improvements
- `gui/quickfort`: blueprints that designate items for dumping/forbidding/etc. no longer show an error highlight for tiles that have no items on them
- `gui/quickfort`: place (stockpile layout) mode is now supported. note that detailed stockpile configurations were part of query mode and are not yet supported
- `gui/quickfort`: you can now generate manager orders for items required to complete bluerpints
- `gui/create-item`: ask for number of items to spawn by default
- `light-aquifers-only`: now available as a fort Autostart option in `gui/control-panel`. note that it will only appear if "armok" tools are configured to be shown on the Preferences tab.
- `gui/gm-editor`: when passing the ``--freeze`` option, further ensure that the game is frozen by halting all rendering (other than for the gm-editor window itself)
Expand Down
8 changes: 4 additions & 4 deletions gui/quickfort.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ function Quickfort:init()
return #transformations == 0 and 'No transform'
or table.concat(transformations, ', ') end}}}}},
widgets.HotkeyLabel{key='CUSTOM_O', label='Generate manager orders',
active=function() return self.blueprint_name and false end,
enabled=function() return self.blueprint_name and false end,
active=function() return self.blueprint_name end,
enabled=function() return self.blueprint_name end,
on_activate=self:callback('do_command', 'orders')},
widgets.HotkeyLabel{key='CUSTOM_SHIFT_O',
label='Preview manager orders',
active=function() return self.blueprint_name and false end,
enabled=function() return self.blueprint_name and false end,
active=function() return self.blueprint_name end,
enabled=function() return self.blueprint_name end,
on_activate=self:callback('do_command', 'orders', true)},
widgets.HotkeyLabel{key='CUSTOM_SHIFT_U', label='Undo blueprint',
active=function() return self.blueprint_name end,
Expand Down
7 changes: 2 additions & 5 deletions internal/quickfort/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ end

local command_switch = {
run='do_run',
-- orders='do_orders', -- until we get stockflow working
orders='do_orders',
undo='do_undo',
}

Expand Down Expand Up @@ -185,7 +185,7 @@ local function do_one_command(command, cursor, blueprint_name, section_name,
if command == 'orders' or mode == 'notes' or mode == 'config' then
cursor = {x=0, y=0, z=0}
else
qerror('please position the game cursor at the blueprint start ' ..
qerror('please position the keyboard cursor at the blueprint start ' ..
'location or use the --cursor option')
end
end
Expand Down Expand Up @@ -234,9 +234,6 @@ end
function do_command(args)
for _,command in ipairs(args.commands) do
if not command or not command_switch[command] then
if command == 'orders' then
qerror('orders functionality not updated yet')
end
qerror(string.format('invalid command: "%s"', command))
end
end
Expand Down
11 changes: 7 additions & 4 deletions internal/quickfort/orders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ end

local quickfort_common = reqscript('internal/quickfort/common')

local ok, stockflow = pcall(require, 'plugins.stockflow')
if not ok then
stockflow = nil
end
-- local ok, stockflow = pcall(require, 'plugins.stockflow')
-- if not ok then
-- stockflow = nil
-- end

-- use our own copy of stockflow logic until stockflow becomes available again
local stockflow = reqscript('internal/quickfort/stockflow')

local log = quickfort_common.log

Expand Down
Loading

0 comments on commit a26e72b

Please sign in to comment.