From d288642b3ca7006b7f5bfa299df5b5720082278b Mon Sep 17 00:00:00 2001 From: Nicholas McDaniel Date: Thu, 5 Dec 2024 15:48:23 -0500 Subject: [PATCH] Reset racefilter on world and map load Prevents usage of stale state when loading multiple worlds or timelines in a single session. --- exportlegends.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exportlegends.lua b/exportlegends.lua index 80a4ec299..305c28545 100644 --- a/exportlegends.lua +++ b/exportlegends.lua @@ -1038,6 +1038,11 @@ dfhack.onStateChange[GLOBAL_KEY] = function(sc) if sc == SC_VIEWSCREEN_CHANGED and df.viewscreen_choose_game_typest:is_instance(dfhack.gui.getDFViewscreen(true)) then asyncexport.reset_state() end + + -- Reset state when a world or map is loaded to ensure data remains current + if sc == SC_WORLD_LOADED or sc == SC_MAP_LOADED then + racefilter.reset_state() + end end if dfhack_flags.module then