diff options
author | unknown <for.oliver.kirkham@gmail.com> | 2023-02-14 13:34:48 +0000 |
---|---|---|
committer | unknown <for.oliver.kirkham@gmail.com> | 2023-02-14 13:34:48 +0000 |
commit | d2079959609f7d1ca444a5903bbdc9f87d7aaa6d (patch) | |
tree | dd14aa55147da9f10d34bd17858f3dcb358f97ba /NorthstarDLL/mods | |
parent | f7fe0b030342a0c76f53a99d2a73cd679f879e71 (diff) | |
download | NorthstarLauncher-d2079959609f7d1ca444a5903bbdc9f87d7aaa6d.tar.gz NorthstarLauncher-d2079959609f7d1ca444a5903bbdc9f87d7aaa6d.zip |
temp commit for changing branch
Diffstat (limited to 'NorthstarDLL/mods')
-rw-r--r-- | NorthstarDLL/mods/modmanager.cpp | 46 | ||||
-rw-r--r-- | NorthstarDLL/mods/modmanager.h | 1 |
2 files changed, 45 insertions, 2 deletions
diff --git a/NorthstarDLL/mods/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp index d2321583..40ed9f3e 100644 --- a/NorthstarDLL/mods/modmanager.cpp +++ b/NorthstarDLL/mods/modmanager.cpp @@ -940,6 +940,12 @@ void ModManager::CheckModFilesForChanges() m_AssetTypesToReload.bDamageDefs = true; continue; } + + if (m_AssetTypesToReload.bDatatables && !pChangedFile->m_Path.parent_path().compare("scripts/datatable/")) + { + m_AssetTypesToReload.bDatatables = true; + continue; + } } } @@ -988,6 +994,11 @@ void ModManager::ReloadNecessaryModAssets() if (m_AssetTypesToReload.bAimAssistSettings) vReloadCommands.push_back("ReloadAimAssistSettings"); + if (m_AssetTypesToReload.bDatatables) + { + // TODO: clear disk datatable cache in scriptdatatables.cpp + } + // need to reimplement mat_reloadmaterials for this //if (m_AssetTypesToReload.bMaterials) // R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "mat_reloadmaterials", R2::cmd_source_t::kCommandSrcCode); @@ -1007,6 +1018,14 @@ void ModManager::ReloadNecessaryModAssets() } R2::Cbuf_Execute(); + + // reset everything we've already reloaded at this point + m_AssetTypesToReload.bUiScript = false; + m_AssetTypesToReload.bLocalisation = false; + m_AssetTypesToReload.bPlaylists = false; + m_AssetTypesToReload.bAimAssistSettings = false; + m_AssetTypesToReload.bDatatables = false; + m_AssetTypesToReload.bModels = false; } void ModManager::InstallMods() @@ -1116,11 +1135,32 @@ void ModManager::CompileAssetsForFile(const char* filename) } } -void ConCommand_reload_mods(const CCommand& args) +void ConCommand_mods_reload(const CCommand& args) { g_pModManager->LoadMods(); } +void ConCommand_mods_getfileowner(const CCommand& args) +{ + if (args.ArgC() < 2) + { + spdlog::warn("usage: mods_getfileowner path/to/file.mdl"); + return; + } + + auto findFile = g_pModManager->GetModFiles().find(g_pModManager->NormaliseModFilePath(args.Arg(1))); + if (findFile != g_pModManager->GetModFiles().end()) + { + // this can be null if asset is compiled! + if (findFile->second.m_pOwningMod != nullptr) + spdlog::info("file \"{}\" is owned by mod {}", args.Arg(1), findFile->second.m_pOwningMod->Name); + else + spdlog::info("file \"{}\" is overriden by a runtime compiled asset", args.Arg(1)); + } + else + spdlog::warn("file not override not found"); +} + fs::path GetModFolderPath() { return GetNorthstarPrefix() / MOD_FOLDER_SUFFIX; @@ -1138,5 +1178,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ModManager, (ConCommand, MasterServer), (CMod { g_pModManager = new ModManager; - RegisterConCommand("reload_mods", ConCommand_reload_mods, "reloads mods", FCVAR_NONE); + RegisterConCommand("reload_mods", ConCommand_mods_reload, "reloads mods", FCVAR_NONE); + RegisterConCommand("mods_reload", ConCommand_mods_reload, "reloads mods", FCVAR_NONE); + RegisterConCommand("mods_getfileowner", ConCommand_mods_getfileowner, "find the mod that owns a given file", FCVAR_NONE); } diff --git a/NorthstarDLL/mods/modmanager.h b/NorthstarDLL/mods/modmanager.h index ea5c4105..253b7812 100644 --- a/NorthstarDLL/mods/modmanager.h +++ b/NorthstarDLL/mods/modmanager.h @@ -169,6 +169,7 @@ class ModManager bool bPlayerSettings = false; bool bAiSettings = false; bool bDamageDefs = false; // damagedefs + bool bDatatables = false; // can't actually reload this atm, just print a warning (todo, could maybe restart client to ensure loaded?) bool bModels = false; |