diff options
author | EladNLG <e1lad8955@gmail.com> | 2022-07-10 18:22:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-10 16:22:59 +0100 |
commit | 85635ad99dbdfa909341e4138f6fdb0c9bf73bf1 (patch) | |
tree | 03a9198f9be9edc3496b3a72510987373369125e /NorthstarDedicatedTest/squirrel.h | |
parent | 151d678453f3e321fcccf2512e6e2f53436f1469 (diff) | |
download | NorthstarLauncher-85635ad99dbdfa909341e4138f6fdb0c9bf73bf1.tar.gz NorthstarLauncher-85635ad99dbdfa909341e4138f6fdb0c9bf73bf1.zip |
Add dependency constants (#156)v1.9.1-rc4v1.9.1-rc3v1.9.1-rc2v1.9.1
* Fix duplicate script in scripts.rson when 2 mods add a custom script with the same path
Allow mods to force a VPK to load through vpk.json
* Remove unnecessary print
* Fix match predicate using the value instead of the name
* - Add a dependency constant system for use in compile flags
- Remove the duplicate script engine error fix
- Add ClientSq_defconst & ServerSq_defconst
* Format fix
* - Fix access violation
- Separate dependency constants into mod and add checks for conflicts
* - Remove unnecessary comment
* Remove VPK loading for now and allow 2 mods to use the same constant if the mod names match
* Fix bugs
* fix mistake
* fix keyvalues not working with modded files
* simplify code
* Fix formatting
* Remove keyvalues fix
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.h')
-rw-r--r-- | NorthstarDedicatedTest/squirrel.h | 21 |
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() |