Skip to content

Commit 4c0d4e4

Browse files
red-001paramat
authored andcommittedJan 16, 2018
Load a texturepack from the 'textures' subfolder of a game
1 parent 70a90bc commit 4c0d4e4

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed
 

‎doc/lua_api.txt

+31-37
Original file line numberDiff line numberDiff line change
@@ -47,47 +47,41 @@ Paths
4747
Games
4848
-----
4949
Games are looked up from:
50-
51-
* `$path_share/games/gameid/`
52-
* `$path_user/games/gameid/`
53-
54-
where `gameid` is unique to each game.
55-
56-
The game directory contains the file `game.conf`, which contains:
57-
58-
name = <Human-readable full name of the game>
59-
60-
e.g.
61-
62-
name = Minetest
63-
64-
Optionally, game.conf can also contain:
65-
66-
disallowed_mapgens = <comma-separated mapgens>
67-
68-
e.g.
69-
70-
disallowed_mapgens = v5,v6,flat
71-
72-
These mapgens are removed from the list of mapgens for the game.
73-
74-
The game directory can contain the file minetest.conf, which will be used
75-
to set default settings when running the particular game.
76-
It can also contain a settingtypes.txt in the same format as the one in builtin.
77-
This settingtypes.txt will be parsed by the menu and the settings will be displayed
78-
in the "Games" category in the settings tab.
50+
* `$path_share/games/gameid/`
51+
* `$path_user/games/gameid/`
52+
Where `gameid` is unique to each game.
53+
54+
The game directory can contain the following files:
55+
* `game.conf`
56+
Which contains:
57+
* name = <Human-readable full name of the game>
58+
e.g.
59+
name = Minetest
60+
* Optionally, game.conf can also contain:
61+
disallowed_mapgens = <comma-separated mapgens>
62+
e.g.
63+
disallowed_mapgens = v5,v6,flat
64+
These mapgens are removed from the list of mapgens for the game.
65+
* minetest.conf
66+
Used to set default settings when running this game.
67+
* settingtypes.txt
68+
In the same format as the one in builtin.
69+
This settingtypes.txt will be parsed by the menu and the settings will be
70+
displayed in the "Games" category in the advanced settings tab.
71+
* If the subgame contains a folder called `textures` the server will load it
72+
as a texturepack, overriding mod textures.
73+
Any server texturepack will override mod textures and the game texturepack.
7974

8075
### Menu images
8176

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

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

9286
Mod load path
9387
-------------

‎src/server.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ Server::Server(
253253
m_nodedef->updateAliases(m_itemdef);
254254

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

259262
m_nodedef->setNodeRegistrationStatus(true);
@@ -2259,8 +2262,9 @@ void Server::fillMediaCache()
22592262
paths.push_back(mod.path + DIR_DELIM + "models");
22602263
paths.push_back(mod.path + DIR_DELIM + "locale");
22612264
}
2262-
fs::GetRecursiveDirs(paths, porting::path_user + DIR_DELIM +
2263-
"textures" + DIR_DELIM + "server");
2265+
fs::GetRecursiveDirs(paths, m_gamespec.path + DIR_DELIM + "textures");
2266+
fs::GetRecursiveDirs(paths, porting::path_user + DIR_DELIM + "textures" + DIR_DELIM + "server");
Has a conversation. Original line has a conversation.
2267+
22642268
// Collect media file information from paths into cache
22652269
for (const std::string &mediapath : paths) {
22662270
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(mediapath);

1 commit comments

Comments
 (1)

red-001 commented on Jan 20, 2018

@red-001
ContributorAuthor

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

Please sign in to comment.