diff options
Diffstat (limited to 'primedev/scripts')
-rw-r--r-- | primedev/scripts/client/scriptmodmenu.cpp | 17 | ||||
-rw-r--r-- | primedev/scripts/scriptjson.cpp | 4 |
2 files changed, 21 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); diff --git a/primedev/scripts/scriptjson.cpp b/primedev/scripts/scriptjson.cpp index 06bda6f4..8959bf47 100644 --- a/primedev/scripts/scriptjson.cpp +++ b/primedev/scripts/scriptjson.cpp @@ -42,6 +42,8 @@ DecodeJsonArray(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char> g_pSquirrel<context>->pushinteger(sqvm, itr.GetInt()); g_pSquirrel<context>->arrayappend(sqvm, -2); break; + case rapidjson::kNullType: + break; } } } @@ -92,6 +94,8 @@ DecodeJsonTable(HSquirrelVM* sqvm, rapidjson::GenericValue<rapidjson::UTF8<char> } g_pSquirrel<context>->newslot(sqvm, -3, false); break; + case rapidjson::kNullType: + break; } } } |