aboutsummaryrefslogtreecommitdiff
path: root/primedev/scripts/client
diff options
context:
space:
mode:
authorRémy Raes <raes.remy@gmail.com>2024-07-04 23:34:16 +0200
committerGitHub <noreply@github.com>2024-07-04 23:34:16 +0200
commit3edcc91c72c96c33f8eae76a7078f78126bbea28 (patch)
treeab40cad2a1d17e759118bdad732132d03ef66345 /primedev/scripts/client
parentafa246978001db279d3e0eabbbe6b32f5c42e1f4 (diff)
downloadNorthstarLauncher-1.26.0-rc4.tar.gz
NorthstarLauncher-1.26.0-rc4.zip
Expose mods remote status to Squirrel VM (#684)v1.26.1-rc3v1.26.1-rc2v1.26.1-rc1v1.26.0-rc4v1.26.0-rc3v1.26.0
Add a Squirrel VM method to know if a given mod is remote or not.
Diffstat (limited to 'primedev/scripts/client')
-rw-r--r--primedev/scripts/client/scriptmodmenu.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/primedev/scripts/client/scriptmodmenu.cpp b/primedev/scripts/client/scriptmodmenu.cpp
index 2e877db4..5ffe0fdf 100644
--- a/primedev/scripts/client/scriptmodmenu.cpp
+++ b/primedev/scripts/client/scriptmodmenu.cpp
@@ -49,6 +49,23 @@ ADD_SQFUNC("void", NSSetModEnabled, "string modName, bool enabled", "", ScriptCo
return SQRESULT_NULL;
}
+ADD_SQFUNC("bool", NSIsModRemote, "string modName", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI)
+{
+ const SQChar* modName = g_pSquirrel<context>->getstring(sqvm, 1);
+
+ // manual lookup, not super performant but eh not a big deal
+ for (Mod& mod : g_pModManager->m_LoadedMods)
+ {
+ if (!mod.Name.compare(modName))
+ {
+ g_pSquirrel<context>->pushbool(sqvm, mod.m_bIsRemote);
+ return SQRESULT_NOTNULL;
+ }
+ }
+
+ return SQRESULT_NULL;
+}
+
ADD_SQFUNC("string", NSGetModDescriptionByModName, "string modName", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI)
{
const SQChar* modName = g_pSquirrel<context>->getstring(sqvm, 1);