aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel
diff options
context:
space:
mode:
authorcat_or_not <41955154+catornot@users.noreply.github.com>2023-12-14 07:07:02 -0500
committerGitHub <noreply@github.com>2023-12-14 13:07:02 +0100
commit43f0bce0596ec60434e48d8037ffed373bc13852 (patch)
tree717f8728ad41369a9e8c6dfe928460e9163014c0 /NorthstarDLL/squirrel
parent0976a3500e6774258322ab2bc80ebd515c175e77 (diff)
downloadNorthstarLauncher-43f0bce0596ec60434e48d8037ffed373bc13852.tar.gz
NorthstarLauncher-43f0bce0596ec60434e48d8037ffed373bc13852.zip
Add plugin dependency constants (#458)v1.21.0-rc1
Adds dependency constants for plugins so mods can rely on plugins without always producing script errors when the plugin is missing
Diffstat (limited to 'NorthstarDLL/squirrel')
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp
index 68fffb9b..d8eff0d6 100644
--- a/NorthstarDLL/squirrel/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -264,6 +264,13 @@ template <ScriptContext context> void SquirrelManager<context>::VMCreated(CSquir
defconst(m_pSQVM, pair.first.c_str(), bWasFound);
}
+ auto loadedPlugins = &g_pPluginManager->m_vLoadedPlugins;
+ for (const auto& pluginName : g_pModManager->m_PluginDependencyConstants)
+ {
+ auto f = [&](Plugin plugin) -> bool { return plugin.dependencyName == pluginName; };
+ defconst(m_pSQVM, pluginName.c_str(), std::find_if(loadedPlugins->begin(), loadedPlugins->end(), f) != loadedPlugins->end());
+ }
+
defconst(m_pSQVM, "MAX_FOLDER_SIZE", GetMaxSaveFolderSize() / 1024);
// define squirrel constants for northstar(.dll) version