| 287 | } |
| 288 | |
| 289 | void InitializeNodeScripts() |
| 290 | { |
| 291 | std::string nodeScriptPath = g_GameFlow->GetGameDir() + "Scripts/Engine/NodeCatalogs/"; |
| 292 | |
| 293 | if (!std::filesystem::is_directory(nodeScriptPath)) |
| 294 | return; |
| 295 | |
| 296 | std::vector<std::string> nodeCatalogs; |
| 297 | for (const auto& path : std::filesystem::recursive_directory_iterator(nodeScriptPath)) |
| 298 | { |
| 299 | if (path.path().extension() == ".lua") |
| 300 | nodeCatalogs.push_back(path.path().filename().string()); |
| 301 | } |
| 302 | |
| 303 | if (nodeCatalogs.empty()) |
| 304 | return; |
| 305 | |
| 306 | TENLog("Loading node scripts...", LogLevel::Info); |
| 307 | |
| 308 | std::sort(nodeCatalogs.rbegin(), nodeCatalogs.rend()); |
| 309 | |
| 310 | if (!nodeCatalogs.empty()) |
| 311 | { |
| 312 | for (const auto& file : nodeCatalogs) |
| 313 | g_GameScript->ExecuteScriptFile(nodeScriptPath + file); |
| 314 | |
| 315 | TENLog(fmt::format("{} node catalog{} found and loaded.", nodeCatalogs.size(), (nodeCatalogs.size() > 1) ? "s were" : " was"), LogLevel::Info); |
| 316 | } |
| 317 | else |
| 318 | { |
| 319 | TENLog("No node catalogs were found.", LogLevel::Warning); |
| 320 | } |
| 321 | |
| 322 | int count = InitializeEventList(g_Level.VolumeEventSets); |
| 323 | if (count != 0) |
| 324 | TENLog(fmt::format("{} volume event{} found and loaded.", count, (count > 1) ? "s were" : " was"), LogLevel::Info); |
| 325 | |
| 326 | count = InitializeEventList(g_Level.GlobalEventSets); |
| 327 | if (count != 0) |
| 328 | TENLog(fmt::format("{} global event{} found and loaded.", count, (count > 1) ? "s were" : " was"), LogLevel::Info); |
| 329 | } |
| 330 | } |
no test coverage detected