You've already forked OpenRCT2-Unity
mirror of
https://github.com/izzy2lost/OpenRCT2-Unity.git
synced 2026-03-10 12:38:22 -07:00
Restart plugins when starting new game from a game
This commit is contained in:
@@ -91,6 +91,10 @@ void ScriptEngine::LoadPlugins()
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
if (_pluginsLoaded)
|
||||
{
|
||||
UnloadPlugins();
|
||||
}
|
||||
|
||||
auto base = _env.GetDirectoryPath(DIRBASE::USER, DIRID::PLUGIN);
|
||||
if (Path::DirectoryExists(base))
|
||||
@@ -112,6 +116,7 @@ void ScriptEngine::LoadPlugins()
|
||||
}
|
||||
}
|
||||
_pluginsLoaded = true;
|
||||
_pluginsStarted = false;
|
||||
}
|
||||
|
||||
void ScriptEngine::LoadPlugin(const std::string& path)
|
||||
@@ -237,6 +242,7 @@ void ScriptEngine::StartPlugins()
|
||||
ScriptExecutionInfo::PluginScope scope(_execInfo, plugin);
|
||||
try
|
||||
{
|
||||
LogPluginInfo(plugin, "Started");
|
||||
plugin->Start();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
@@ -253,6 +259,7 @@ void ScriptEngine::StopPlugins()
|
||||
for (auto& plugin : _plugins)
|
||||
{
|
||||
StopPlugin(plugin);
|
||||
LogPluginInfo(plugin, "Stopped");
|
||||
}
|
||||
_pluginsStarted = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user