MCPcopy Create free account
hub / github.com/SapphireServer/Sapphire / init

Method init

src/world/Script/ScriptMgr.cpp:48–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48bool Sapphire::Scripting::ScriptMgr::init()
49{
50 std::set< std::string > files;
51 auto& serverMgr = Common::Service< World::ServerMgr >::ref();
52
53 auto status = loadDir( serverMgr.getConfig().scripts.path, files, m_nativeScriptMgr->getModuleExtension() );
54
55 if( !status )
56 {
57 Logger::error( "ScriptMgr: failed to load modules, the server will not function correctly without scripts loaded." );
58 return false;
59 }
60
61 uint32_t scriptsFound = 0;
62 uint32_t scriptsLoaded = 0;
63
64 for( auto itr = files.begin(); itr != files.end(); ++itr )
65 {
66 auto& path = *itr;
67
68 scriptsFound++;
69
70 if( m_nativeScriptMgr->loadScript( path ) )
71 scriptsLoaded++;
72 }
73
74 Logger::info( "ScriptMgr: Loaded {0}/{1} modules", scriptsLoaded, scriptsFound );
75
76 watchDirectories();
77
78 return true;
79}
80
81void Sapphire::Scripting::ScriptMgr::watchDirectories()
82{

Callers

nothing calls this directly

Calls 4

loadScriptMethod · 0.80
getModuleExtensionMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected