mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +00:00
Restore logic that was accidentally removed in !2852. Because of it onUpdate
handler in local Lua scripts doesn't work.
This commit is contained in:
parent
35f8cef469
commit
75e47f859c
@ -292,14 +292,19 @@ namespace MWLua
|
|||||||
mWorldView.objectAddedToScene(ptr); // assigns generated RefNum if it is not set yet.
|
mWorldView.objectAddedToScene(ptr); // assigns generated RefNum if it is not set yet.
|
||||||
mEngineEvents.addToQueue(EngineEvents::OnActive{ getId(ptr) });
|
mEngineEvents.addToQueue(EngineEvents::OnActive{ getId(ptr) });
|
||||||
|
|
||||||
if (!ptr.getRefData().getLuaScripts())
|
LocalScripts* localScripts = ptr.getRefData().getLuaScripts();
|
||||||
|
if (!localScripts)
|
||||||
{
|
{
|
||||||
LuaUtil::ScriptIdsWithInitializationData autoStartConf
|
LuaUtil::ScriptIdsWithInitializationData autoStartConf
|
||||||
= mConfiguration.getLocalConf(getLiveCellRefType(ptr.mRef), ptr.getCellRef().getRefId(), getId(ptr));
|
= mConfiguration.getLocalConf(getLiveCellRefType(ptr.mRef), ptr.getCellRef().getRefId(), getId(ptr));
|
||||||
// TODO: put to a queue and apply `addAutoStartedScripts` on next `update()`
|
|
||||||
if (!autoStartConf.empty())
|
if (!autoStartConf.empty())
|
||||||
createLocalScripts(ptr, std::move(autoStartConf))->addAutoStartedScripts();
|
{
|
||||||
|
localScripts = createLocalScripts(ptr, std::move(autoStartConf));
|
||||||
|
localScripts->addAutoStartedScripts(); // TODO: put to a queue and apply on next `update()`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (localScripts)
|
||||||
|
mActiveLocalScripts.insert(localScripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaManager::objectRemovedFromScene(const MWWorld::Ptr& ptr)
|
void LuaManager::objectRemovedFromScene(const MWWorld::Ptr& ptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user