Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose mods remote status to Squirrel VM #684

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions primedev/scripts/client/scriptmodmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down