File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -313,19 +313,17 @@ function JournalScreen:onDismiss()
313313end
314314
315315function main (options )
316- local fortress_worldmap_mode = not dfhack .isMapLoaded () and dfhack .world .isFortressMode ()
317- local fortress_mode = dfhack .isMapLoaded () and dfhack .world .isFortressMode ()
318- local adventure_mode = dfhack .isMapLoaded () and dfhack .world .isAdventureMode ()
316+ local journal_context_mode = journal_context .detect_journal_context_mode ()
319317
320- if not fortress_mode and not adventure_mode and not fortress_worldmap_mode then
321- qerror (' journal requires a fortress/adventure map to be loaded' )
318+ if journal_context_mode == nil then
319+ qerror (' journal requires a fortress/adventure/world/legends map to be loaded' )
322320 end
323321
324322 local save_layout = options and options .save_layout
325323 local overrided_context_mode = options and options .context_mode
326324
327325 local context_mode = overrided_context_mode == nil and
328- journal_context . detect_journal_context_mode () or overrided_context_mode
326+ journal_context_mode or overrided_context_mode
329327
330328 view = view and view :raise () or JournalScreen {
331329 save_prefix = options and options .save_prefix or ' ' ,
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ local AdventurerJournalContext = reqscript('internal/journal/contexts/adventure'
1010JOURNAL_CONTEXT_MODE = {
1111 FORTRESS = ' fortress' ,
1212 ADVENTURE = ' adventure' ,
13- WORLDMAP = ' WORLDMAP' ,
13+ WORLDMAP = ' worldmap' ,
14+ LEGENDS = ' legends' ,
1415 DUMMY = ' dummy'
1516}
1617
@@ -21,8 +22,10 @@ function detect_journal_context_mode()
2122 return JOURNAL_CONTEXT_MODE .FORTRESS
2223 elseif dfhack .isMapLoaded () and dfhack .world .isAdventureMode () then
2324 return JOURNAL_CONTEXT_MODE .ADVENTURE
25+ elseif dfhack .world .isLegends () then
26+ return JOURNAL_CONTEXT_MODE .LEGENDS
2427 else
25- qerror ( ' unsupported game mode ' )
28+ return nil
2629 end
2730end
2831
@@ -44,6 +47,10 @@ function journal_context_factory(journal_context_mode, save_prefix)
4447 elseif journal_context_mode == JOURNAL_CONTEXT_MODE .WORLDMAP then
4548 local world_id = df .global .world .cur_savegame .world_header .id1
4649
50+ return WorldmapJournalContext {save_prefix = save_prefix , world_id = world_id }
51+ elseif journal_context_mode == JOURNAL_CONTEXT_MODE .LEGENDS then
52+ local world_id = df .global .world .cur_savegame .world_header .id1
53+
4754 return WorldmapJournalContext {save_prefix = save_prefix , world_id = world_id }
4855 elseif journal_context_mode == JOURNAL_CONTEXT_MODE .DUMMY then
4956 return DummyJournalContext {}
You can’t perform that action at this time.
0 commit comments