Minetest  5.4.0
ServerModManager Class Reference

Manage server mods. More...

#include <mods.h>

+ Inheritance diagram for ServerModManager:
+ Collaboration diagram for ServerModManager:

Public Member Functions

 ServerModManager (const std::string &worldpath)
 Creates a ServerModManager which targets worldpath. More...
 
void loadMods (ServerScripting *script)
 
const ModSpecgetModSpec (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< ModSpecm_sorted_mods
 

Detailed Description

Manage server mods.

All new calls to this class must be tested in test_servermodmanager.cpp

Constructor & Destructor Documentation

◆ ServerModManager()

ServerModManager::ServerModManager ( const std::string &  worldpath)

Creates a ServerModManager which targets worldpath.

Manage server mods.

Parameters
worldpathAll 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.

+ Here is the call graph for this function:

Member Function Documentation

◆ getModNames()

void ServerModManager::getModNames ( std::vector< std::string > &  modlist) const

References ModConfiguration::m_sorted_mods.

Referenced by TestServerModManager::testGetModNames(), and TestServerModManager::testGetModNamesWrongDir().

+ Here is the caller graph for this function:

◆ getModsMediaPaths()

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.

Parameters
pathsresult vector

References DIR_DELIM, fs::GetRecursiveDirs(), ModConfiguration::m_sorted_mods, and ModSpec::path.

Referenced by TestServerModManager::testGetModMediaPaths(), and TestServerModManager::testGetModMediaPathsWrongDir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModSpec()

const ModSpec * ServerModManager::getModSpec ( const std::string &  modname) const

References ModConfiguration::m_sorted_mods, and ModSpec::name.

Referenced by TestServerModManager::testGetModspec().

+ Here is the caller graph for this function:

◆ loadMods()

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().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: