2014-05-04 22:59:59 -06:00
|
|
|
-- Export everything from legends mode
|
2014-09-09 01:47:26 -06:00
|
|
|
-- use "exportlegends maps" for detailed maps, or "exportlegends all" to also export legends
|
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
|
|
|
}
|
|
|
|
function wait_for_legends_vs()
|
2014-05-11 18:34:57 -06:00
|
|
|
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
|
|
|
|
function wait_for_export_maps_vs()
|
2014-05-11 18:34:57 -06:00
|
|
|
vs = dfhack.gui.getCurViewscreen()
|
|
|
|
if df.viewscreen_export_graphical_mapst:is_instance(vs) then
|
2014-09-09 01:47:26 -06:00
|
|
|
vs.sel_idx = i
|
|
|
|
print(' Exporting: '..MAPS[i]..' map')
|
2014-05-11 18:34:57 -06:00
|
|
|
i = i + 1
|
2014-09-09 01:47:26 -06:00
|
|
|
gui.simulateInput(vs, 'SELECT')
|
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
|
|
|
|
|
|
|
|
if df.viewscreen_legendsst:is_instance( vs ) then -- dfhack.gui.getCurFocus() == "legends"
|
2014-05-11 18:34:57 -06:00
|
|
|
if args[1] == "all" then
|
|
|
|
gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_MAP)
|
2014-09-09 01:47:26 -06:00
|
|
|
print(' Exporting: world map/gen info')
|
2014-05-11 18:34:57 -06:00
|
|
|
gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_XML)
|
2014-09-09 01:47:26 -06:00
|
|
|
print(' Exporting: legends xml')
|
2014-05-11 18:34:57 -06:00
|
|
|
wait_for_legends_vs()
|
|
|
|
elseif args[1] == "maps" then wait_for_legends_vs()
|
|
|
|
end
|
2014-05-04 22:59:59 -06:00
|
|
|
elseif df.viewscreen_export_graphical_mapst:is_instance(vs) then
|
2014-09-09 01:47:26 -06:00
|
|
|
if args[1] == "maps" or args[1] == "all" then wait_for_export_maps_vs() end
|
2014-05-04 22:59:59 -06:00
|
|
|
else
|
2014-05-11 18:34:57 -06:00
|
|
|
dfhack.printerr('Not in legends view')
|
2014-05-04 22:59:59 -06:00
|
|
|
end
|