fixed whitespace again to four-space indentations

should have read the documentation before trying a style fix...
develop
PeridexisErrant 2014-05-12 10:34:57 +10:00
parent 795325b6ef
commit 01d302efc3
2 changed files with 64 additions and 64 deletions

@ -12,57 +12,57 @@ if args[1] then print(' A script which exports data from legends mode. Valid
local MAPS = { local MAPS = {
[0] = "Standard biome+site map", [0] = "Standard biome+site map",
"Elevations including lake and ocean floors", "Elevations including lake and ocean floors",
"Elevations respecting water level", "Elevations respecting water level",
"Biome", "Biome",
"Hydrosphere", "Hydrosphere",
"Temperature", "Temperature",
"Rainfall", "Rainfall",
"Drainage", "Drainage",
"Savagery", "Savagery",
"Volcanism", "Volcanism",
"Current vegetation", "Current vegetation",
"Evil", "Evil",
"Salinity", "Salinity",
"Structures/fields/roads/etc.", "Structures/fields/roads/etc.",
"Trade", "Trade",
} }
function wait_for_legends_vs() function wait_for_legends_vs()
vs = dfhack.gui.getCurViewscreen() vs = dfhack.gui.getCurViewscreen()
if i < 15 then if i < 15 then
if df.viewscreen_legendsst:is_instance(vs) then if df.viewscreen_legendsst:is_instance(vs) then
gui.simulateInput(vs, 'LEGENDS_EXPORT_DETAILED_MAP') -- "d" on screen some number internally gui.simulateInput(vs, 'LEGENDS_EXPORT_DETAILED_MAP') -- "d" on screen some number internally
dfhack.timeout(10,'frames',wait_for_export_maps_vs) dfhack.timeout(10,'frames',wait_for_export_maps_vs)
else else
dfhack.timeout(10,'frames',wait_for_legends_vs) dfhack.timeout(10,'frames',wait_for_legends_vs)
end
end end
end
end end
function wait_for_export_maps_vs() function wait_for_export_maps_vs()
vs = dfhack.gui.getCurViewscreen() vs = dfhack.gui.getCurViewscreen()
if df.viewscreen_export_graphical_mapst:is_instance(vs) then if df.viewscreen_export_graphical_mapst:is_instance(vs) then
vs.anon_13 = i -- anon_13 appears to be the selection cursor for this viewscreen vs.anon_13 = i -- anon_13 appears to be the selection cursor for this viewscreen
print('Exporting: '..MAPS[i]) print('Exporting: '..MAPS[i])
i = i + 1 i = i + 1
gui.simulateInput(vs, 'SELECT') -- 1 internally, enter on screen gui.simulateInput(vs, 'SELECT') -- 1 internally, enter on screen
dfhack.timeout(10,'frames',wait_for_legends_vs) dfhack.timeout(10,'frames',wait_for_legends_vs)
else else
dfhack.timeout(10,'frames',wait_for_export_maps_vs) dfhack.timeout(10,'frames',wait_for_export_maps_vs)
end end
end end
if df.viewscreen_legendsst:is_instance( vs ) then -- dfhack.gui.getCurFocus() == "legends" if df.viewscreen_legendsst:is_instance( vs ) then -- dfhack.gui.getCurFocus() == "legends"
if args[1] == "all" then if args[1] == "all" then
gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_MAP) gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_MAP)
print('Exporting: world map/gen info') print('Exporting: world map/gen info')
gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_XML) gui.simulateInput(vs, df.interface_key.LEGENDS_EXPORT_XML)
print('Exporting: legends xml') print('Exporting: legends xml')
wait_for_legends_vs() wait_for_legends_vs()
elseif args[1] == "maps" then wait_for_legends_vs() elseif args[1] == "maps" then wait_for_legends_vs()
end end
elseif df.viewscreen_export_graphical_mapst:is_instance(vs) then elseif df.viewscreen_export_graphical_mapst:is_instance(vs) then
if args[1] == "maps" or "all" then wait_for_export_maps_vs() end if args[1] == "maps" or "all" then wait_for_export_maps_vs() end
else else
dfhack.printerr('Not in legends view') dfhack.printerr('Not in legends view')
end end

@ -9,27 +9,27 @@ end
local args = {...} local args = {...}
if args[1] == 'disable' then if args[1] == 'disable' then
dfhack.onStateChange[_ENV] = nil dfhack.onStateChange[_ENV] = nil
else else
dfhack.onStateChange[_ENV] = function(op) dfhack.onStateChange[_ENV] = function(op)
if op == SC_WORLD_LOADED then if op == SC_WORLD_LOADED then
if df.world_site.find(df.global.ui.site_id) ~= nil then -- added this check, now only attempts write in fort mode if df.world_site.find(df.global.ui.site_id) ~= nil then -- added this check, now only attempts write in fort mode
local site = df.world_site.find(df.global.ui.site_id) local site = df.world_site.find(df.global.ui.site_id)
local fort_ent = df.global.ui.main.fortress_entity local fort_ent = df.global.ui.main.fortress_entity
local civ_ent = df.historical_entity.find(df.global.ui.civ_id) local civ_ent = df.historical_entity.find(df.global.ui.civ_id)
local worldname = df.global.world.world_data.name local worldname = df.global.world.world_data.name
-- site positions -- site positions
-- site .pos.x .pos.y -- site .pos.x .pos.y
-- site .rgn_min_x .rgn_min_y .rgn_max_x .rgn_max.y -- site .rgn_min_x .rgn_min_y .rgn_max_x .rgn_max.y
-- site .global_min_x .global_min_y .global_max_x .global_max_y -- site .global_min_x .global_min_y .global_max_x .global_max_y
--site.name --site.name
--fort_ent.name --fort_ent.name
--civ_ent.name --civ_ent.name
write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..dfhack.TranslateName(worldname)..' ('..dfhack.TranslateName(worldname ,true)..') at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE.. write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..dfhack.TranslateName(worldname)..' ('..dfhack.TranslateName(worldname ,true)..') at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE..
'Loaded the fortress '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), colonized by the group '..dfhack.TranslateName(fort_ent.name)..' ('..dfhack.TranslateName(fort_ent.name,true).. 'Loaded the fortress '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), colonized by the group '..dfhack.TranslateName(fort_ent.name)..' ('..dfhack.TranslateName(fort_ent.name,true)..
') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE) ') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE)
end end
end end
end end
end end