Manages server mods. More...
#include <mods.h>
Public Member Functions | |
| ServerModManager (const std::string &worldpath, SubgameSpec gamespec) | |
| Creates a ServerModManager. | |
| 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, |
| SubgameSpec | gamespec ) |
Creates a ServerModManager.
Manage server mods.
| worldpath | path to world |
| gamespec | game used by the world |
All new calls to this class must be tested in test_servermodmanager.cpp
References SubgameSpec::addon_mods_paths, configuration, and DIR_DELIM.
|
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.
|
inline |
References configuration.
| 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, fs::GetRecursiveDirs(), and ModSpec::path.
| const ModSpec * ServerModManager::getModSpec | ( | const std::string & | modname | ) | const |
References configuration.
|
inline |
References configuration.
|
inline |
References configuration.
|
inline |
References configuration.
| void ServerModManager::loadMods | ( | ServerScripting & | script | ) |
References configuration, DIR_DELIM, porting::getTimeMs(), infostream, ScriptApiBase::loadMod(), and ScriptApiServer::on_mods_loaded().
|
private |
Referenced by ServerModManager(), getModNames(), getMods(), getModsMediaPaths(), getModSpec(), getUnsatisfiedMods(), getUnsatisfiedModsError(), isConsistent(), and loadMods().