Merge remote-tracking branch 'lethosor/global-onload'

develop
expwnent 2014-09-16 16:53:31 -04:00
commit 3e882f35b3
2 changed files with 5 additions and 0 deletions

@ -1,4 +1,7 @@
DFHack future
Internals:
- support for global onLoadWorld.init and onUnloadWorld.init files,
called when loading and unloading a world
DFHack 0.40.11-r1

@ -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: