diff options
author | kwolekr <kwolekr@minetest.net> | 2013-08-04 22:59:22 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-08-11 15:34:49 -0400 |
commit | c06caa14c31ffa480146a7dbb7094224a486c1bd (patch) | |
tree | aa647a832e856a9b71e5fed67a74cee52f405f6e /src/script/common/c_content.cpp | |
parent | 56b9377c1c55a08eb5ae09c058f9f1cb8e9e4a73 (diff) | |
download | minetest-c06caa14c31ffa480146a7dbb7094224a486c1bd.tar.gz minetest-c06caa14c31ffa480146a7dbb7094224a486c1bd.tar.bz2 minetest-c06caa14c31ffa480146a7dbb7094224a486c1bd.zip |
Decoration: Fix schematic probability mess with new MTS file version
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r-- | src/script/common/c_content.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index f9765b655..ca7c7fde9 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -956,8 +956,24 @@ bool read_schematic(lua_State *L, int index, DecoSchematic *dschem, Server *serv lua_pushnil(L); while (lua_next(L, -2)) { - if (i < numnodes) - schemdata[i] = readnode(L, -1, ndef); + if (i < numnodes) { + // same as readnode, except param1 default is MTSCHEM_PROB_CONST + lua_getfield(L, -1, "name"); + const char *name = luaL_checkstring(L, -1); + lua_pop(L, 1); + + u8 param1; + lua_getfield(L, -1, "param1"); + param1 = !lua_isnil(L, -1) ? lua_tonumber(L, -1) : MTSCHEM_PROB_ALWAYS; + lua_pop(L, 1); + + u8 param2; + lua_getfield(L, -1, "param2"); + param2 = !lua_isnil(L, -1) ? lua_tonumber(L, -1) : 0; + lua_pop(L, 1); + + schemdata[i] = MapNode(ndef, name, param1, param2); + } i++; lua_pop(L, 1); |