Luanti 5.16.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, SubgameSpec gamespec)
 Creates a ServerModManager.
 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,
SubgameSpec gamespec )

Creates a ServerModManager.

Manage server mods.

Parameters
worldpathpath to world
gamespecgame 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.

◆ 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.

◆ getMods()

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

References configuration.

◆ 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, fs::GetRecursiveDirs(), and ModSpec::path.

Here is the call graph for this function:

◆ getModSpec()

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

References configuration.

◆ getUnsatisfiedMods()

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

References configuration.

◆ getUnsatisfiedModsError()

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

References configuration.

◆ isConsistent()

bool ServerModManager::isConsistent ( ) const
inline

References configuration.

◆ loadMods()

void ServerModManager::loadMods ( ServerScripting & script)

References configuration, DIR_DELIM, porting::getTimeMs(), infostream, ScriptApiBase::loadMod(), and ScriptApiServer::on_mods_loaded().

Here is the call graph for this function:

Member Data Documentation

◆ configuration


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