mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 21:29:56 +00:00
Merge branch 'fix_lua' into 'master'
Restore logic that was accidentally removed in !2852. See merge request OpenMW/openmw!2943
This commit is contained in:
commit
4738f0ff4d
1 changed files with 8 additions and 3 deletions
|
@ -292,15 +292,20 @@ 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…
Reference in a new issue