diff options
author | Dániel Juhász <juhdanad@gmail.com> | 2017-04-21 15:34:59 +0200 |
---|---|---|
committer | Zeno- <kde.psych@gmail.com> | 2017-04-21 23:34:59 +1000 |
commit | 1ffb180868ffcec6812cd3aac8f56ffefb91c8bc (patch) | |
tree | 2b7dc1d209bda384fbd995dc7f13ffdd3587818f /src/script/common | |
parent | 2ad74a9e8b9da48aef62346de6cd55f304c6440d (diff) | |
download | minetest-1ffb180868ffcec6812cd3aac8f56ffefb91c8bc.tar.gz minetest-1ffb180868ffcec6812cd3aac8f56ffefb91c8bc.tar.bz2 minetest-1ffb180868ffcec6812cd3aac8f56ffefb91c8bc.zip |
Soft node overlay (#5186)
This commit adds node overlays, which are tiles that are drawn on top of
other tiles.
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_content.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 8dfb851e6..573347b4c 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -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 |