1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +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:
psi29a 2023-04-19 10:56:42 +00:00
commit 4738f0ff4d

View File

@ -292,14 +292,19 @@ namespace MWLua
mWorldView.objectAddedToScene(ptr); // assigns generated RefNum if it is not set yet.
mEngineEvents.addToQueue(EngineEvents::OnActive{ getId(ptr) });
if (!ptr.getRefData().getLuaScripts())
LocalScripts* localScripts = ptr.getRefData().getLuaScripts();
if (!localScripts)
{
LuaUtil::ScriptIdsWithInitializationData autoStartConf
= mConfiguration.getLocalConf(getLiveCellRefType(ptr.mRef), ptr.getCellRef().getRefId(), getId(ptr));
// TODO: put to a queue and apply `addAutoStartedScripts` on next `update()`
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)