2014-05-04 22:59:59 -06:00
|
|
|
-- Export everything from legends mode
|
2014-09-24 05:34:09 -06:00
|
|
|
-- Valid args: "all", "info", "maps", "sites"
|
2014-05-04 22:59:59 -06:00
|
|
|
|
|
|
|
gui = require 'gui'
|
|
|
|
local args = {...}
|
|
|
|
local vs = dfhack.gui.getCurViewscreen()
|
2014-09-09 01:47:26 -06:00
|
|
|
local i = 1
|
2014-05-04 22:59:59 -06:00
|
|
|
|
|
|
|
local MAPS = {
|
2014-09-09 01:47:26 -06:00
|
|
|
"Standard biome+site map",
|
2014-05-11 18:34:57 -06:00
|
|
|
"Elevations including lake and ocean floors",
|
|
|
|
"Elevations respecting water level",
|
|
|
|
"Biome",
|
|
|
|
"Hydrosphere",
|
|
|
|
"Temperature",
|
|
|
|
"Rainfall",
|
|
|
|
"Drainage",
|
|
|
|
"Savagery",
|
|
|
|
"Volcanism",
|
|
|
|
"Current vegetation",
|
|
|
|
"Evil",
|
|
|
|
"Salinity",
|
|
|
|
"Structures/fields/roads/etc.",
|
|
|
|
"Trade",
|
2014-09-09 01:47:26 -06:00
|
|
|
"Nobility and Holdings",
|
|
|
|
"Diplomacy",
|
2014-05-04 22:59:59 -06:00
|
|
|
}
|
2014-09-24 05:34:09 -06:00
|
|
|
|
|
|
|
-- export information and XML ('p, x')
|
|
|
|
function export_legends_info()
|
|
|
|
print(' Exporting: World map/gen info')
|
|
|
|
gui.simulateInput(vs, 'LEGENDS_EXPORT_MAP')
|
|
|
|
print(' Exporting: Legends xml')
|
|
|
|
gui.simulateInput(vs, 'LEGENDS_EXPORT_XML')
|
|
|
|
end
|
|
|
|
|
|
|
|
-- presses 'd' for detailed maps
|
2014-05-04 22:59:59 -06:00
|
|
|
function wait_for_legends_vs()
|
2014-09-24 05:34:09 -06:00
|
|
|
local vs = dfhack.gui.getCurViewscreen()
|
2014-09-09 01:47:26 -06:00
|
|
|
if i <= #MAPS then
|
2014-05-11 18:34:57 -06:00
|
|
|
if df.viewscreen_legendsst:is_instance(vs) then
|
2014-09-09 01:47:26 -06:00
|
|
|
gui.simulateInput(vs, 'LEGENDS_EXPORT_DETAILED_MAP')
|
2014-05-11 18:34:57 -06:00
|
|
|
dfhack.timeout(10,'frames',wait_for_export_maps_vs)
|
|
|
|
else
|
|
|
|
dfhack.timeout(10,'frames',wait_for_legends_vs)
|
2014-05-11 18:22:04 -06:00
|
|
|
end
|
2014-05-11 18:34:57 -06:00
|
|
|
end
|
2014-05-04 22:59:59 -06:00
|
|
|
end
|
2014-09-24 05:34:09 -06:00
|
|
|
|
|
|
|
-- selects detailed map and export it
|
2014-05-04 22:59:59 -06:00
|
|
|
function wait_for_export_maps_vs()
|
2014-09-24 05:34:09 -06:00
|
|
|
local vs = dfhack.gui.getCurViewscreen()
|
|
|
|
if dfhack.gui.getCurFocus() == "export_graphical_map" then
|
2014-12-14 16:22:05 -07:00
|
|
|
vs.sel_idx = i-1
|
2014-09-09 01:47:26 -06:00
|
|
|
print(' Exporting: '..MAPS[i]..' map')
|
|
|
|
gui.simulateInput(vs, 'SELECT')
|
2014-09-24 05:34:09 -06:00
|
|
|
i = i + 1
|
2014-05-11 18:34:57 -06:00
|
|
|
dfhack.timeout(10,'frames',wait_for_legends_vs)
|
|
|
|
else
|
|
|
|
dfhack.timeout(10,'frames',wait_for_export_maps_vs)
|
|
|
|
end
|
2014-05-04 22:59:59 -06:00
|
|
|
end
|
|
|
|
|
2014-09-24 05:34:09 -06:00
|
|
|
-- export site maps
|
|
|
|
function export_site_maps()
|
|
|
|
local vs = dfhack.gui.getCurViewscreen()
|
|
|
|
print(' Exporting: All possible site maps')
|
2014-11-08 15:18:53 -07:00
|
|
|
vs.main_cursor = 1
|
2014-09-24 05:34:09 -06:00
|
|
|
gui.simulateInput(vs, 'SELECT')
|
|
|
|
for i=1, #vs.sites do
|
|
|
|
gui.simulateInput(vs, 'LEGENDS_EXPORT_MAP')
|
|
|
|
gui.simulateInput(vs, 'STANDARDSCROLL_DOWN')
|
|
|
|
end
|
|
|
|
gui.simulateInput(vs, 'LEAVESCREEN')
|
|
|
|
end
|
|
|
|
|
|
|
|
-- main()
|
|
|
|
if dfhack.gui.getCurFocus() == "legends" then
|
|
|
|
if args[1] == "all" then
|
|
|
|
export_legends_info()
|
|
|
|
export_site_maps()
|
2014-05-11 18:34:57 -06:00
|
|
|
wait_for_legends_vs()
|
2014-09-24 05:34:09 -06:00
|
|
|
elseif args[1] == "info" then
|
2014-12-24 04:10:04 -07:00
|
|
|
export_legends_info()
|
2014-09-24 05:34:09 -06:00
|
|
|
elseif args[1] == "maps" then
|
|
|
|
wait_for_legends_vs()
|
|
|
|
elseif args[1] == "sites" then
|
|
|
|
export_site_maps()
|
|
|
|
else dfhack.printerr('Valid arguments are "all", "info", "maps" or "sites"')
|
2014-05-11 18:34:57 -06:00
|
|
|
end
|
2014-12-14 16:22:05 -07:00
|
|
|
elseif args[1] == "maps" and
|
|
|
|
dfhack.gui.getCurFocus() == "export_graphical_map" then
|
|
|
|
wait_for_export_maps_vs()
|
2014-05-04 22:59:59 -06:00
|
|
|
else
|
2014-12-14 16:22:05 -07:00
|
|
|
dfhack.printerr('Exportlegends must be run from the main legends view')
|
2014-09-24 05:34:09 -06:00
|
|
|
end
|