mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Decoration: Fix schematic probability mess with new MTS file version
This commit is contained in:
parent
56b9377c1c
commit
c06caa14c3
8 changed files with 75 additions and 37 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue