diff options
Diffstat (limited to 'NorthstarDedicatedTest/scriptmodmenu.cpp')
-rw-r--r-- | NorthstarDedicatedTest/scriptmodmenu.cpp | 19 |
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); |