1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Allow overwriting media files of dependencies (#10752)

This commit is contained in:
DS 2021-02-23 19:39:15 +01:00 committed by GitHub
parent 29681085b9
commit 4abe4b87b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 4 deletions

View file

@ -98,7 +98,8 @@ void ServerModManager::getModNames(std::vector<std::string> &modlist) const
void ServerModManager::getModsMediaPaths(std::vector<std::string> &paths) const
{
for (const ModSpec &spec : m_sorted_mods) {
for (auto it = m_sorted_mods.crbegin(); it != m_sorted_mods.crend(); it++) {
const ModSpec &spec = *it;
fs::GetRecursiveDirs(paths, spec.path + DIR_DELIM + "textures");
fs::GetRecursiveDirs(paths, spec.path + DIR_DELIM + "sounds");
fs::GetRecursiveDirs(paths, spec.path + DIR_DELIM + "media");

View file

@ -42,5 +42,13 @@ public:
void loadMods(ServerScripting *script);
const ModSpec *getModSpec(const std::string &modname) const;
void getModNames(std::vector<std::string> &modlist) 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.
*
* @param paths result vector
*/
void getModsMediaPaths(std::vector<std::string> &paths) const;
};