Skip to content

Commit

Permalink
Merge pull request #3654 from myk002/myk_mod_reload
Browse files Browse the repository at this point in the history
ensure active mod scripts are properly reloaded
  • Loading branch information
myk002 authored Aug 8, 2023
2 parents 7b1bbec + 62a1bd6 commit 970babe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Template for new versions:
## New Features

## Fixes
- Core: properly reload scripts in mods when a world is unloaded and immediately loaded again

## Misc Improvements
- `hotkeys`: don't display DFHack logo in legends mode since it covers up important interface elements. the Ctrl-Shift-C hotkey to bring up the menu and the mouseover hotspot still function, though.
Expand Down
5 changes: 3 additions & 2 deletions library/lua/script-manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ function reload(refresh_active_mod_scripts)
enabled_map = utils.OrderedTable()
local force_refresh_fn = refresh_active_mod_scripts and function(script_path, script_name)
if script_path:find('scripts_modactive') then
internal_script = dfhack.internal.scripts[script_path..'/'..script_name]
local full_path = script_path..'/'..script_name
internal_script = dfhack.internal.scripts[full_path]
if internal_script then
internal_script.env = nil
dfhack.internal.scripts[full_path] = nil
end
end
end or nil
Expand Down

0 comments on commit 970babe

Please sign in to comment.