void CModHandler::loadMods() { const JsonNode modConfig = loadModSettings("config/modSettings.json"); loadMods("", "", modConfig["activeMods"], true); coreMod = CModInfo("core", modConfig["core"], JsonNode(ResourceID("config/gameConfig.json"))); coreMod.name = "Original game files"; }
void CModHandler::loadMods(std::string path, std::string parent, const JsonNode & modSettings, bool enableMods) { for (std::string modName : getModList(path)) { boost::to_lower(modName); std::string modFullName = parent.empty() ? modName : parent + '.' + modName; if (CResourceHandler::get("initial")->existsResource(ResourceID(CModInfo::getModFile(modFullName)))) { CModInfo mod(modFullName, modSettings[modName], JsonNode(ResourceID(CModInfo::getModFile(modFullName)))); if (!parent.empty()) // this is submod, add parent to dependecies mod.dependencies.insert(parent); allMods[modFullName] = mod; if (mod.enabled && enableMods) activeMods.push_back(modFullName); loadMods(CModInfo::getModDir(modFullName) + '/', modFullName, modSettings[modName]["mods"], enableMods && mod.enabled); } } }
bool ScriptManager::reloadMods() { clearMods(); return loadMods(); }
CModManager::CModManager(CModList * modList): modList(modList) { loadMods(); loadModSettings(); }
void RenderState::loadEverything() { loadManagedAssembly(); loadMods(); }