use new dig-now and tiletypes-here APIs

develop
myk002 2021-06-07 05:22:39 -07:00
parent 3225f5ccf8
commit c2b92ce6a0
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 16 additions and 20 deletions

@ -21,8 +21,6 @@ config = {
mode = 'fortress', mode = 'fortress',
} }
local guidm = require('gui.dwarfmode')
local blueprints_dir = 'blueprints/' local blueprints_dir = 'blueprints/'
local input_dir = 'library/test/ecosystem/in/' local input_dir = 'library/test/ecosystem/in/'
local output_dir = 'library/test/ecosystem/out/' local output_dir = 'library/test/ecosystem/out/'
@ -191,22 +189,20 @@ local function run_blueprint(basename, set, pos)
end end
local function reset_area(area, spec) local function reset_area(area, spec)
dfhack.run_command('tiletypes-command', 'f', 'any') local commands = {
dfhack.run_command('tiletypes-command', 'p', 'any') 'f', 'any', ';',
dfhack.run_command('tiletypes-command', 'p', 's', 'wall') 'p', 'any', ';',
dfhack.run_command('tiletypes-command', 'p', 'sp', 'normal') 'p', 's', 'wall', ';',
dfhack.run_command('tiletypes-command', 'p', 'h', '1') 'p', 'sp', 'normal', ';',
dfhack.run_command('tiletypes-command', 'r', tostring(spec.width), 'p', 'h', '1', ';',
tostring(spec.height), tostring(spec.depth)) 'r', tostring(spec.width), tostring(spec.height), tostring(spec.depth)}
local tiletypes_pos = copyall(area.pos) dfhack.run_command('tiletypes-command', table.unpack(commands))
tiletypes_pos.z = tiletypes_pos.z - spec.depth + 1 -- tiletypes goes up z's
-- tiletypes goes up z's, so adjust starting zlevel accordingly
-- we fake the cursor position so 'tiletypes-here' works even if there is no local pos = copyall(area.pos)
-- actual live game cursor pos.z = pos.z - spec.depth + 1
local saved_cursor = guidm.getCursorPos()
guidm.setCursorPos(tiletypes_pos) dfhack.run_command('tiletypes-here', '--quiet', get_cursor_arg(pos))
dfhack.run_command('tiletypes-here')
if saved_cursor then guidm.setCursorPos(saved_cursor) end
end end
function test.end_to_end() function test.end_to_end()
@ -234,8 +230,8 @@ function test.end_to_end()
designate_area(area.pos, set.spec) designate_area(area.pos, set.spec)
end end
-- run dig-dug to dig out designated tiles -- run dig-now to dig out designated tiles
dfhack.run_command('dig-dug') dfhack.run_command('dig-now')
-- quickfort run remaining blueprints -- quickfort run remaining blueprints
for _,mode_name in pairs(mode_names) do for _,mode_name in pairs(mode_names) do