Skip to content

Commit

Permalink
Load a texturepack from the 'textures' subfolder of a game
Browse files Browse the repository at this point in the history
  • Loading branch information
red-001 authored and paramat committed Jan 16, 2018
1 parent 70a90bc commit 4c0d4e4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
68 changes: 31 additions & 37 deletions doc/lua_api.txt
Expand Up @@ -47,47 +47,41 @@ Paths
Games
-----
Games are looked up from:

* `$path_share/games/gameid/`
* `$path_user/games/gameid/`

where `gameid` is unique to each game.

The game directory contains the file `game.conf`, which contains:

name = <Human-readable full name of the game>

e.g.

name = Minetest

Optionally, game.conf can also contain:

disallowed_mapgens = <comma-separated mapgens>

e.g.

disallowed_mapgens = v5,v6,flat

These mapgens are removed from the list of mapgens for the game.

The game directory can contain the file minetest.conf, which will be used
to set default settings when running the particular game.
It can also contain a settingtypes.txt in the same format as the one in builtin.
This settingtypes.txt will be parsed by the menu and the settings will be displayed
in the "Games" category in the settings tab.
* `$path_share/games/gameid/`
* `$path_user/games/gameid/`
Where `gameid` is unique to each game.

The game directory can contain the following files:
* `game.conf`
Which contains:
* name = <Human-readable full name of the game>
e.g.
name = Minetest
* Optionally, game.conf can also contain:
disallowed_mapgens = <comma-separated mapgens>
e.g.
disallowed_mapgens = v5,v6,flat
These mapgens are removed from the list of mapgens for the game.
* minetest.conf
Used to set default settings when running this game.
* settingtypes.txt
In the same format as the one in builtin.
This settingtypes.txt will be parsed by the menu and the settings will be
displayed in the "Games" category in the advanced settings tab.
* If the subgame contains a folder called `textures` the server will load it
as a texturepack, overriding mod textures.
Any server texturepack will override mod textures and the game texturepack.

### Menu images

Games can provide custom main menu images. They are put inside a `menu` directory
inside the game directory.

The images are named `$identifier.png`, where `$identifier` is
one of `overlay,background,footer,header`.
If you want to specify multiple images for one identifier, add additional images named
like `$identifier.$n.png`, with an ascending number $n starting with 1, and a random
image will be chosen from the provided ones.
Games can provide custom main menu images. They are put inside a `menu`
directory inside the game directory.

The images are named `$identifier.png`, where `$identifier` is one of
`overlay`, `background`, `footer`, `header`.
If you want to specify multiple images for one identifier, add additional
images named like `$identifier.$n.png`, with an ascending number $n starting
with 1, and a random image will be chosen from the provided ones.

Mod load path
-------------
Expand Down
10 changes: 7 additions & 3 deletions src/server.cpp
Expand Up @@ -253,7 +253,10 @@ Server::Server(
m_nodedef->updateAliases(m_itemdef);

// Apply texture overrides from texturepack/override.txt
for (const auto &path : fs::GetRecursiveDirs(g_settings->get("texture_path")))
std::vector<std::string> paths;
fs::GetRecursiveDirs(paths, g_settings->get("texture_path"));
fs::GetRecursiveDirs(paths, m_gamespec.path + DIR_DELIM + "textures");
for (const std::string &path : paths)
m_nodedef->applyTextureOverrides(path + DIR_DELIM + "override.txt");

m_nodedef->setNodeRegistrationStatus(true);
Expand Down Expand Up @@ -2259,8 +2262,9 @@ void Server::fillMediaCache()
paths.push_back(mod.path + DIR_DELIM + "models");
paths.push_back(mod.path + DIR_DELIM + "locale");
}
fs::GetRecursiveDirs(paths, porting::path_user + DIR_DELIM +
"textures" + DIR_DELIM + "server");
fs::GetRecursiveDirs(paths, m_gamespec.path + DIR_DELIM + "textures");
fs::GetRecursiveDirs(paths, porting::path_user + DIR_DELIM + "textures" + DIR_DELIM + "server");

This comment has been minimized.

Copy link
@SmallJoker

SmallJoker Mar 22, 2020

Member

Is this path documented somewhere? At least in texture_packs.txt it isn't.
EDIT:

<DS-minetest> it's documented in texture_packs_here.txt


// Collect media file information from paths into cache
for (const std::string &mediapath : paths) {
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(mediapath);
Expand Down

1 comment on commit 4c0d4e4

@red-001
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jastevenson303 I don't see how naming a mod that could cause an issue.

Please sign in to comment.