| 46 | } |
| 47 | |
| 48 | bool 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 | |
| 81 | void Sapphire::Scripting::ScriptMgr::watchDirectories() |
| 82 | { |
nothing calls this directly
no test coverage detected