mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Allow overwriting media files of dependencies (#10752)
This commit is contained in:
parent
29681085b9
commit
4abe4b87b5
@ -256,6 +256,9 @@ Subfolders with names starting with `_` or `.` are ignored.
|
||||
If a subfolder contains a media file with the same name as a media file
|
||||
in one of its parents, the parent's file is used.
|
||||
|
||||
Although it is discouraged, a mod can overwrite a media file of any mod that it
|
||||
depends on by supplying a file with an equal name.
|
||||
|
||||
Naming conventions
|
||||
------------------
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 7.1 KiB |
@ -1,3 +0,0 @@
|
||||
This is for testing loading textures from subfolders.
|
||||
If it works correctly, the default_grass_side.png file in this folder is used but
|
||||
default_grass.png is not overwritten by the file in this folder.
|
7
games/devtest/mods/basenodes/textures/info.txt
Normal file
7
games/devtest/mods/basenodes/textures/info.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
The dirt_with_grass folder is for testing loading textures from subfolders.
|
||||
If it works correctly, the default_grass_side.png file in the folder is used but
|
||||
default_grass.png is not overwritten by the file in the folder.
|
||||
|
||||
default_dirt.png should be overwritten by the default_dirt.png in the unittests
|
||||
mod which depends on basenodes.
|
@ -1,2 +1,3 @@
|
||||
name = unittests
|
||||
description = Adds automated unit tests for the engine
|
||||
depends = basenodes
|
||||
|
BIN
games/devtest/mods/unittests/textures/default_dirt.png
Normal file
BIN
games/devtest/mods/unittests/textures/default_dirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 790 B |
@ -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");
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user