Support for global onLoadWorld.init/onUnloadWorld.init scripts

develop
lethosor 2014-08-30 22:37:23 -04:00
parent 248e4d837b
commit 34d4537a11
2 changed files with 4 additions and 0 deletions

@ -2,6 +2,8 @@ DFHack future
Internals:
- Plugins on OS X now use ".plug.dylib" as an extension instead of ".plug.so"
- support for global onLoadWorld.init and onUnloadWorld.init files,
called when loading and unloading a world
Fixes:
- hack-wish should work now

@ -1435,9 +1435,11 @@ static void handleLoadAndUnloadScripts(Core* core, color_ostream& out, state_cha
std::string rawFolder = "data" + separator + "save" + separator + (df::global::world->cur_savegame.save_dir) + separator + "raw" + separator;
switch(event) {
case SC_WORLD_LOADED:
core->loadScriptFile(out, "onLoadWorld.init", true);
core->loadScriptFile(out, rawFolder + "onLoad.init", true);
break;
case SC_WORLD_UNLOADED:
core->loadScriptFile(out, "onUnloadWorld.init", true);
core->loadScriptFile(out, rawFolder + "onUnload.init", true);
break;
default: