Repairing the log-region script

A typo was causing the gamelog to always omit the fortress group's untranslated name, while failing to fully prevent the error message caused by unloading the fortress.
develop
Eric Wald 2014-08-16 15:50:01 -06:00
parent 59e6607d8c
commit 73a67b4a64
1 changed files with 10 additions and 4 deletions

@ -7,6 +7,10 @@ local function write_gamelog(msg)
log:close() log:close()
end end
local function fullname(item)
return dfhack.TranslateName(item.name)..' ('..dfhack.TranslateName(item.name ,true)..')'
end
local args = {...} local args = {...}
if args[1] == 'disable' then if args[1] == 'disable' then
dfhack.onStateChange[_ENV] = nil dfhack.onStateChange[_ENV] = nil
@ -17,7 +21,7 @@ else
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
-- 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
@ -26,9 +30,11 @@ else
--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..', '..fullname(worldname)..
'Loaded the fortress '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), colonized by the group '..(fort_end and dfhack.TranslateName(fort_ent.name) or '(nobody?)')..' ('..dfhack.TranslateName(fort_ent.name,true).. ' at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE..
') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE) 'Loaded the fortress '..fullname(site)..
(fort_ent and ', colonized by the group '..fullname(fort_ent) or '')..
(civ_ent and ' of the civilization '..fullname(civ_ent) or '')..'.'..NEWLINE)
end end
end end
end end