diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-12-19 19:32:16 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-01-04 14:45:48 +0100 |
commit | 27afb0ba38dcf0e74a4d09ba43e73261542b8e96 (patch) | |
tree | 28c737bdecc761fc8ca5257adfafaf2b325e1918 /NorthstarDLL/modscriptsrson.cpp | |
parent | af64117f09ba9b70d27c6b6da885d0474180849b (diff) | |
download | NorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.tar.gz NorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.zip |
Restructuring (#365)
* Remove launcher proxy
* Restructuring
* More restructuring
* Fix include dirs
* Fix merge
* Remove clang thing
* Filters
* Oops
Diffstat (limited to 'NorthstarDLL/modscriptsrson.cpp')
-rw-r--r-- | NorthstarDLL/modscriptsrson.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/NorthstarDLL/modscriptsrson.cpp b/NorthstarDLL/modscriptsrson.cpp deleted file mode 100644 index 3615dd80..00000000 --- a/NorthstarDLL/modscriptsrson.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "pch.h" -#include "modmanager.h" -#include "filesystem.h" -#include "squirrel.h" - -#include <fstream> - -const std::string MOD_SCRIPTS_RSON_SUFFIX = "scripts/vscripts/scripts.rson"; -const char* VPK_SCRIPTS_RSON_PATH = "scripts\\vscripts\\scripts.rson"; - -void ModManager::BuildScriptsRson() -{ - spdlog::info("Building custom scripts.rson"); - fs::path MOD_SCRIPTS_RSON_PATH = fs::path(GetCompiledAssetsPath() / MOD_SCRIPTS_RSON_SUFFIX); - fs::remove(MOD_SCRIPTS_RSON_PATH); - - std::string scriptsRson = R2::ReadVPKOriginalFile(VPK_SCRIPTS_RSON_PATH); - scriptsRson += "\n\n// START MODDED SCRIPT CONTENT\n\n"; // newline before we start custom stuff - - for (Mod& mod : m_LoadedMods) - { - if (!mod.m_bEnabled) - continue; - - // this isn't needed at all, just nice to have imo - scriptsRson += "// MOD: "; - scriptsRson += mod.Name; - scriptsRson += ":\n\n"; - - for (ModScript& script : mod.Scripts) - { - /* should create something with this format for each script - When: "CONTEXT" - Scripts: - [ - _coolscript.gnut - ]*/ - - scriptsRson += "When: \""; - scriptsRson += script.RunOn; - scriptsRson += "\"\n"; - - scriptsRson += "Scripts:\n[\n\t"; - scriptsRson += script.Path; - scriptsRson += "\n]\n\n"; - } - } - - fs::create_directories(MOD_SCRIPTS_RSON_PATH.parent_path()); - - std::ofstream writeStream(MOD_SCRIPTS_RSON_PATH, std::ios::binary); - writeStream << scriptsRson; - writeStream.close(); - - ModOverrideFile overrideFile; - overrideFile.m_pOwningMod = nullptr; - overrideFile.m_Path = VPK_SCRIPTS_RSON_PATH; - - if (m_ModFiles.find(VPK_SCRIPTS_RSON_PATH) == m_ModFiles.end()) - m_ModFiles.insert(std::make_pair(VPK_SCRIPTS_RSON_PATH, overrideFile)); - else - m_ModFiles[VPK_SCRIPTS_RSON_PATH] = overrideFile; - - // todo: for preventing dupe scripts in scripts.rson, we could actually parse when conditions with the squirrel vm, just need a way to - // get a result out of squirrelmanager.ExecuteCode this would probably be the best way to do this, imo -} |