1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Soft node overlay (#5186)

This commit adds node overlays, which are tiles that are drawn on top of
other tiles.
This commit is contained in:
Dániel Juhász 2017-04-21 15:34:59 +02:00 committed by Zeno-
parent 2ad74a9e8b
commit 1ffb180868
18 changed files with 763 additions and 467 deletions

View file

@ -426,6 +426,34 @@ ContentFeatures read_content_features(lua_State *L, int index)
}
lua_pop(L, 1);
// overlay_tiles = {}
lua_getfield(L, index, "overlay_tiles");
if (lua_istable(L, -1)) {
int table = lua_gettop(L);
lua_pushnil(L);
int i = 0;
while (lua_next(L, table) != 0) {
// Read tiledef from value
f.tiledef_overlay[i] = read_tiledef(L, -1, f.drawtype);
// removes value, keeps key for next iteration
lua_pop(L, 1);
i++;
if (i == 6) {
lua_pop(L, 1);
break;
}
}
// Copy last value to all remaining textures
if (i >= 1) {
TileDef lasttile = f.tiledef_overlay[i - 1];
while (i < 6) {
f.tiledef_overlay[i] = lasttile;
i++;
}
}
}
lua_pop(L, 1);
// special_tiles = {}
lua_getfield(L, index, "special_tiles");
// If nil, try the deprecated name "special_materials" instead