Manage server mods. More...
#include <mods.h>
Public Member Functions | |
ServerModManager (const std::string &worldpath) | |
Creates a ServerModManager which targets worldpath. More... | |
void | loadMods (ServerScripting *script) |
const ModSpec * | getModSpec (const std::string &modname) const |
void | getModNames (std::vector< std::string > &modlist) const |
void | getModsMediaPaths (std::vector< std::string > &paths) const |
Recursively gets all paths of mod folders that can contain media files. More... | |
Public Member Functions inherited from ModConfiguration | |
bool | isConsistent () const |
const std::vector< ModSpec > & | getMods () const |
const std::vector< ModSpec > & | getUnsatisfiedMods () const |
void | printUnsatisfiedModsError () const |
Additional Inherited Members | |
Protected Member Functions inherited from ModConfiguration | |
ModConfiguration (const std::string &worldpath) | |
void | addModsInPath (const std::string &path) |
void | addMods (const std::vector< ModSpec > &new_mods) |
void | addModsFromConfig (const std::string &settings_path, const std::set< std::string > &mods) |
void | checkConflictsAndDeps () |
Protected Attributes inherited from ModConfiguration | |
std::vector< ModSpec > | m_sorted_mods |
Manage server mods.
All new calls to this class must be tested in test_servermodmanager.cpp
ServerModManager::ServerModManager | ( | const std::string & | worldpath | ) |
Creates a ServerModManager which targets worldpath.
Manage server mods.
worldpath | All new calls to this class must be tested in test_servermodmanager.cpp Creates a ServerModManager which targets worldpath |
worldpath |
References ModConfiguration::addModsFromConfig(), ModConfiguration::addModsInPath(), SubgameSpec::addon_mods_paths, DIR_DELIM, findWorldSubgame(), and SubgameSpec::gamemods_path.
void ServerModManager::getModNames | ( | std::vector< std::string > & | modlist | ) | const |
References ModConfiguration::m_sorted_mods.
Referenced by TestServerModManager::testGetModNames(), and TestServerModManager::testGetModNamesWrongDir().
void ServerModManager::getModsMediaPaths | ( | std::vector< std::string > & | paths | ) | const |
Recursively gets all paths of mod folders that can contain media files.
Result is ordered in descending priority, ie. files from an earlier path should not be replaced by files from a latter one.
paths | result vector |
References DIR_DELIM, fs::GetRecursiveDirs(), ModConfiguration::m_sorted_mods, and ModSpec::path.
Referenced by TestServerModManager::testGetModMediaPaths(), and TestServerModManager::testGetModMediaPathsWrongDir().
const ModSpec * ServerModManager::getModSpec | ( | const std::string & | modname | ) | const |
References ModConfiguration::m_sorted_mods, and ModSpec::name.
Referenced by TestServerModManager::testGetModspec().
void ServerModManager::loadMods | ( | ServerScripting * | script | ) |
References DIR_DELIM, porting::getTimeMs(), infostream, ScriptApiBase::loadMod(), ModConfiguration::m_sorted_mods, MODNAME_ALLOWED_CHARS, ScriptApiServer::on_mods_loaded(), and string_allowed().