Working on stuff
This commit is contained in:
1 parent
17d903fd52
commit
07f45ad1e1
11 files changed
+176
-70
No files matched your search
@@ -1995,6 +1995,24 @@ namespace ZL
|
||||
if (in.contains("scriptGlobals")) {
|
||||
scriptEngine.loadScriptGlobals(in["scriptGlobals"]);
|
||||
}
|
||||
|
||||
// Re-wire in-flight, one-shot Lua callbacks (walk-arrival / animation-complete)
|
||||
// that were serialized by name. Must run after scriptEngine has already run the
|
||||
// location's script (guaranteed: Location::setup() always runs before load())
|
||||
// and after the states above are restored.
|
||||
if (player && !player->state.onArrivedCallbackName.empty()) {
|
||||
scriptEngine.rehydrateNamedCallback(player->state.onArrivedCallbackName, player->state.onArrivedCallback);
|
||||
}
|
||||
for (auto& npc : npcs) {
|
||||
if (npc && !npc->state.onArrivedCallbackName.empty()) {
|
||||
scriptEngine.rehydrateNamedCallback(npc->state.onArrivedCallbackName, npc->state.onArrivedCallback);
|
||||
}
|
||||
}
|
||||
for (auto& intObj : interactiveObjects) {
|
||||
if (intObj.state.isAnimating && intObj.state.animTask && !intObj.state.animTask->onCompleteName.empty()) {
|
||||
scriptEngine.rehydrateNamedCallback(intObj.state.animTask->onCompleteName, intObj.state.animTask->onComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user