1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Load files from subfolders in texturepacks

Updated and rebased version of a PR by red-001
This commit is contained in:
number Zero 2017-09-13 23:03:18 +03:00 committed by paramat
parent ae9b1aa177
commit 05d93c7fa1
7 changed files with 63 additions and 19 deletions

View file

@ -253,9 +253,8 @@ Server::Server(
m_nodedef->updateAliases(m_itemdef);
// Apply texture overrides from texturepack/override.txt
std::string texture_path = g_settings->get("texture_path");
if (!texture_path.empty() && fs::IsDir(texture_path))
m_nodedef->applyTextureOverrides(texture_path + DIR_DELIM + "override.txt");
for (const auto &path : fs::GetRecursiveDirs(g_settings->get("texture_path")))
m_nodedef->applyTextureOverrides(path + DIR_DELIM + "override.txt");
m_nodedef->setNodeRegistrationStatus(true);
@ -2253,8 +2252,8 @@ void Server::fillMediaCache()
paths.push_back(mod.path + DIR_DELIM + "models");
paths.push_back(mod.path + DIR_DELIM + "locale");
}
paths.push_back(porting::path_user + DIR_DELIM + "textures" + DIR_DELIM + "server");
fs::GetRecursiveDirs(paths, porting::path_user + DIR_DELIM +
"textures" + DIR_DELIM + "server");
// Collect media file information from paths into cache
for (const std::string &mediapath : paths) {
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(mediapath);