Skip to content

Commit

Permalink
Repairing the log-region script
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eswald committed Aug 17, 2014
1 parent 59e6607 commit 73a67b4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/log-region.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ local function write_gamelog(msg)
log:close()
end

local function fullname(item)
return dfhack.TranslateName(item.name)..' ('..dfhack.TranslateName(item.name ,true)..')'
end

local args = {...}
if args[1] == 'disable' then
dfhack.onStateChange[_ENV] = nil
Expand All @@ -17,7 +21,7 @@ else
local site = df.world_site.find(df.global.ui.site_id)
local fort_ent = df.global.ui.main.fortress_entity
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 .pos.x .pos.y
-- site .rgn_min_x .rgn_min_y .rgn_max_x .rgn_max.y
Expand All @@ -26,9 +30,11 @@ else
--fort_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..
'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)..
') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE)
write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..fullname(worldname)..
' at coordinates ('..site.pos.x..','..site.pos.y..')'..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
Expand Down

0 comments on commit 73a67b4

Please sign in to comment.