aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/squirrel.h
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.h')
-rw-r--r--NorthstarDedicatedTest/squirrel.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/squirrel.h b/NorthstarDedicatedTest/squirrel.h
index cbdf0c8c..0e49c7f8 100644
--- a/NorthstarDedicatedTest/squirrel.h
+++ b/NorthstarDedicatedTest/squirrel.h
@@ -1,3 +1,4 @@
+#include <../modmanager.h>
#pragma once
void InitialiseClientSquirrel(HMODULE baseAddress);
@@ -121,6 +122,10 @@ typedef SQInteger (*sq_pusherrorType)(void* sqvm, const SQChar* error);
extern sq_pusherrorType ClientSq_pusherror;
extern sq_pusherrorType ServerSq_pusherror;
+typedef void (*sq_defconst)(void* sqvm, const SQChar* name, int value);
+extern sq_defconst ClientSq_defconst;
+extern sq_defconst ServerSq_defconst;
+
typedef SQRESULT (*sq_pushAssetType)(void* sqvm, const SQChar* assetName, SQInteger nameLength);
extern sq_pushAssetType ServerSq_pushAsset;
extern sq_pushAssetType ClientSq_pushAsset;
@@ -172,6 +177,22 @@ template <ScriptContext context> class SquirrelManager
else
ServerRegisterSquirrelFunc(sqvm, funcReg, 1);
}
+ for (auto& pair : g_ModManager->DependencyConstants)
+ {
+ bool wasFound = false;
+ for (Mod& dependency : g_ModManager->m_loadedMods)
+ {
+ if (dependency.Name == pair.second)
+ {
+ wasFound = dependency.Enabled;
+ break;
+ }
+ }
+ if (context == ScriptContext::SERVER)
+ ServerSq_defconst(sqvm, pair.first.c_str(), wasFound);
+ else
+ ClientSq_defconst(sqvm, pair.first.c_str(), wasFound);
+ }
}
void VMDestroyed()