- sandbox stuff.
- Fix lua scripts that could run when their lua state was destroyed, causing chaos.
This commit is contained in:
Quentin
2023-07-13 09:36:13 +02:00
committed by GitHub
parent bd84dbaa40
commit 0a5cca8c12
5 changed files with 174 additions and 68 deletions
+17
View File
@@ -33,6 +33,11 @@ namespace big
m_scripts.clear();
}
void script_mgr::add_on_script_batch_removed(std::function<void()> f)
{
m_on_script_batch_removed.push(f);
}
void script_mgr::tick()
{
gta_util::execute_as_script(RAGE_JOAAT("main_persistent"), std::mem_fn(&script_mgr::tick_internal), this);
@@ -62,6 +67,18 @@ namespace big
return iter->m_should_be_deleted;
});
while (m_on_script_batch_removed.size())
{
auto& f = m_on_script_batch_removed.front();
if (f)
{
f();
}
m_on_script_batch_removed.pop();
}
if (g_lua_manager->m_schedule_reload_modules)
{
g_lua_manager->load_all_modules();