aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/scriptmodmenu.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-19 02:18:24 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-19 02:18:24 +0100
commited7e4fed4ddedaf9d4c181052ca552a0914d57bb (patch)
tree0d451e40d82b0513c4f2acd42ea750638b1d4c88 /NorthstarDedicatedTest/scriptmodmenu.cpp
parent9b8a6d155a7a2cf1bfb4e8d98980bfb0b6e94d92 (diff)
downloadNorthstarLauncher-ed7e4fed4ddedaf9d4c181052ca552a0914d57bb.tar.gz
NorthstarLauncher-ed7e4fed4ddedaf9d4c181052ca552a0914d57bb.zip
add masterserver mod list support and fix some squirrel issues
Diffstat (limited to 'NorthstarDedicatedTest/scriptmodmenu.cpp')
-rw-r--r--NorthstarDedicatedTest/scriptmodmenu.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/scriptmodmenu.cpp b/NorthstarDedicatedTest/scriptmodmenu.cpp
index 74319f56..c17b23db 100644
--- a/NorthstarDedicatedTest/scriptmodmenu.cpp
+++ b/NorthstarDedicatedTest/scriptmodmenu.cpp
@@ -127,6 +127,24 @@ SQInteger SQ_GetModLoadPriority(void* sqvm)
return 0; // return null
}
+// bool NSIsModRequiredOnClient(string modName)
+SQInteger SQ_IsModRequiredOnClient(void* sqvm)
+{
+ const SQChar* modName = ClientSq_getstring(sqvm, 1);
+
+ // manual lookup, not super performant but eh not a big deal
+ for (Mod* mod : g_ModManager->m_loadedMods)
+ {
+ if (!mod->Name.compare(modName))
+ {
+ ClientSq_pushbool(sqvm, mod->RequiredOnClient);
+ return 1;
+ }
+ }
+
+ return 0; // return null
+}
+
// array<string> NSGetModConvarsByModName(string modName)
SQInteger SQ_GetModConvars(void* sqvm)
{
@@ -169,6 +187,7 @@ void InitialiseScriptModMenu(HMODULE baseAddress)
g_UISquirrelManager->AddFuncRegistration("string", "NSGetModDescriptionByModName", "string modName", "Returns a given mod's description", SQ_GetModDescription);
g_UISquirrelManager->AddFuncRegistration("string", "NSGetModVersionByModName", "string modName", "Returns a given mod's version", SQ_GetModVersion);
g_UISquirrelManager->AddFuncRegistration("string", "NSGetModDownloadLinkByModName", "string modName", "Returns a given mod's download link", SQ_GetModDownloadLink);
+ g_UISquirrelManager->AddFuncRegistration("bool", "NSIsModRequiredOnClient", "string modName", "Returns whether a given mod is required on connecting clients", SQ_IsModEnabled);
g_UISquirrelManager->AddFuncRegistration("int", "NSGetModLoadPriority", "string modName", "Returns a given mod's load priority", SQ_GetModLoadPriority);
g_UISquirrelManager->AddFuncRegistration("array<string>", "NSGetModConvarsByModName", "string modName", "Returns the names of all a given mod's cvars", SQ_GetModConvars);