Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
ServerModManager Class Reference

Manages server mods. More...

#include <mods.h>

+ Collaboration diagram for ServerModManager:

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 ModSpecgetModSpec (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
 

Detailed Description

Manages server mods.

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

Constructor & Destructor Documentation

◆ ServerModManager() [1/2]

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

Creates a ServerModManager which targets worldpath.

Manage server mods.

Parameters
worldpath

All new calls to this class must be tested in test_servermodmanager.cpp Creates a ServerModManager which targets worldpath

Parameters
worldpath

References ModConfiguration::addGameMods(), ModConfiguration::addModsFromConfig(), ModConfiguration::addModsInPath(), SubgameSpec::addon_mods_paths, ModConfiguration::checkConflictsAndDeps(), configuration, DIR_DELIM, and findWorldSubgame().

+ Here is the call graph for this function:

◆ ServerModManager() [2/2]

ServerModManager::ServerModManager ( std::nullptr_t )
inlineexplicit

Creates an empty ServerModManager.

For testing purposes. Note: definition looks like this so it isn't accidentally used.

Member Function Documentation

◆ getModNames()

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

References configuration, and ModConfiguration::getMods().

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

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

◆ getMods()

const std::vector< ModSpec > & ServerModManager::getMods ( ) const
inline

References configuration, and ModConfiguration::getMods().

Referenced by Server::AsyncRunStep(), Server::getMods(), TestServerModManager::testGetMods(), and TestServerModManager::testGetModsWrongDir().

+ Here is the call graph for this function:
+ 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 configuration, DIR_DELIM, ModConfiguration::getMods(), fs::GetRecursiveDirs(), and ModSpec::path.

Referenced by Server::fillMediaCache(), 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 configuration, and ModConfiguration::getMods().

Referenced by Server::getModSpec(), TestServerModManager::testGetModMediaPaths(), and TestServerModManager::testGetModspec().

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

◆ getUnsatisfiedMods()

const std::vector< ModSpec > & ServerModManager::getUnsatisfiedMods ( ) const
inline

References configuration, and ModConfiguration::getUnsatisfiedMods().

Referenced by TestServerModManager::testUnsatisfiedMods().

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

◆ getUnsatisfiedModsError()

std::string ServerModManager::getUnsatisfiedModsError ( ) const
inline

References configuration, and ModConfiguration::getUnsatisfiedModsError().

Referenced by Server::init().

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

◆ isConsistent()

bool ServerModManager::isConsistent ( ) const
inline

References configuration, and ModConfiguration::isConsistent().

Referenced by Server::init(), and TestServerModManager::testIsConsistent().

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

◆ loadMods()

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

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

Member Data Documentation

◆ configuration


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