Working on stuff

This commit is contained in:
Vladislav Khorev committed 2026-07-10 14:09:31 +03:00
1 parent 17d903fd52
commit 07f45ad1e1
11 files changed
+176 -70

No files matched your search

+18
View File
@@ -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