MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / InitializeNodeScripts

Function InitializeNodeScripts

TombEngine/Game/control/volume.cpp:289–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 1

DoLevelFunction · 0.85

Calls 11

TENLogFunction · 0.85
InitializeEventListFunction · 0.85
GetGameDirMethod · 0.80
ExecuteScriptFileMethod · 0.80
formatFunction · 0.50
push_backMethod · 0.45
filenameMethod · 0.45
emptyMethod · 0.45
rbeginMethod · 0.45
rendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected