Manages server mods. More...
#include <mods.h>
Public Member Functions | |
ServerModManager (const std::string &worldpath) | |
Creates a ServerModManager which targets worldpath. | |
ServerModManager (std::nullptr_t) | |
Creates an empty ServerModManager. | |
void | loadMods (ServerScripting &script) |
const ModSpec * | getModSpec (const std::string &modname) const |
void | getModNames (std::vector< std::string > &modlist) const |
const std::vector< ModSpec > & | getMods () const |
const std::vector< ModSpec > & | getUnsatisfiedMods () const |
bool | isConsistent () const |
std::string | getUnsatisfiedModsError () const |
void | getModsMediaPaths (std::vector< std::string > &paths) const |
Recursively gets all paths of mod folders that can contain media files. | |
Private Attributes | |
ModConfiguration | configuration |
Manages 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::addGameMods(), ModConfiguration::addModsFromConfig(), ModConfiguration::addModsInPath(), SubgameSpec::addon_mods_paths, ModConfiguration::checkConflictsAndDeps(), configuration, DIR_DELIM, and findWorldSubgame().
|
inlineexplicit |
Creates an empty ServerModManager.
For testing purposes. Note: definition looks like this so it isn't accidentally used.
void ServerModManager::getModNames | ( | std::vector< std::string > & | modlist | ) | const |
References configuration, and ModConfiguration::getMods().
Referenced by TestServerModManager::testGetModNames(), and TestServerModManager::testGetModNamesWrongDir().
|
inline |
References configuration, and ModConfiguration::getMods().
Referenced by Server::AsyncRunStep(), Server::getMods(), TestServerModManager::testGetMods(), and TestServerModManager::testGetModsWrongDir().
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 configuration, DIR_DELIM, ModConfiguration::getMods(), fs::GetRecursiveDirs(), and ModSpec::path.
Referenced by Server::fillMediaCache(), TestServerModManager::testGetModMediaPaths(), and TestServerModManager::testGetModMediaPathsWrongDir().
const ModSpec * ServerModManager::getModSpec | ( | const std::string & | modname | ) | const |
References configuration, and ModConfiguration::getMods().
Referenced by Server::getModSpec(), TestServerModManager::testGetModMediaPaths(), and TestServerModManager::testGetModspec().
|
inline |
References configuration, and ModConfiguration::getUnsatisfiedMods().
Referenced by TestServerModManager::testUnsatisfiedMods().
|
inline |
References configuration, and ModConfiguration::getUnsatisfiedModsError().
Referenced by Server::init().
|
inline |
References configuration, and ModConfiguration::isConsistent().
Referenced by Server::init(), and TestServerModManager::testIsConsistent().
void ServerModManager::loadMods | ( | ServerScripting & | script | ) |
References configuration, DIR_DELIM, ModConfiguration::getMods(), porting::getTimeMs(), infostream, ScriptApiBase::loadMod(), and ScriptApiServer::on_mods_loaded().
Referenced by Server::init().
|
private |
Referenced by ServerModManager(), getModNames(), getMods(), getModsMediaPaths(), getModSpec(), getUnsatisfiedMods(), getUnsatisfiedModsError(), isConsistent(), and loadMods().