dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

[51.13] Modules from scripts_modactive are not reactivated when reopening your save

Open Bltgn opened this issue 8 months ago • 2 comments

Hello,

My mod have a module in the scripts_modactive directory (here's the code).

As recommended in the modding guide, it adds an entry in dfhack.onStateChange and set it to nil when the map is unloaded.

The problem is that DFHack does not reread the script when you return to the main menu and load another save. Since the state change has been removed and is never restored, the mod is broken.

To fix that, DFHack should rerun modules whenever a world is loaded. An alternative would be to give the equivalent of init.d for mods.

Thank you for your work.

Bltgn avatar Jul 04 '25 09:07 Bltgn

Hi, I came back to this issue since it was reported by a player and I figured out the problem.

This is related to portable mode. If the game is not in this mode but has a local installed_mods, dfhack cannot find the scripts anymore. This happens when you update on Steam and I presume when you play with portable mode enabled then disable it.

Bltgn avatar Dec 11 '25 20:12 Bltgn

Hi, I came back to this issue since it was reported by a player and I figured out the problem.

This is related to portable mode. If the game is not in this mode but has a local installed_mods, dfhack cannot find the scripts anymore. This happens when you update on Steam and I presume when you play with portable mode enabled then disable it.

This makes sense. Our logic for locating game saves is not fully synchronized with DF's logic, and so there can be problems when loading a save from the "alternate" location. I'm still working on rewriting our filesystem logic to deal with portable mode shenanigans better, but that process isn't completed yet

ab9rf avatar Dec 12 '25 00:12 ab9rf