// add_node_level(pos, level) // pos = {x=num, y=num, z=num} // level: 0..63 int ModApiEnvMod::l_add_node_level(lua_State *L) { GET_ENV_PTR; v3s16 pos = read_v3s16(L, 1); u8 level = 1; if(lua_isnumber(L, 2)) level = lua_tonumber(L, 2); MapNode n = env->getMap().getNodeNoEx(pos); lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level)); env->setNode(pos, n); return 1; }
// add_node_level(pos, level) // pos = {x=num, y=num, z=num} // level: 0..63 int ModApiEnvMod::l_add_node_level(lua_State *L) { GET_ENV_PTR; v3s16 pos = read_v3s16(L, 1); u8 level = 1; bool compress = 0; if(lua_isnumber(L, 2)) level = lua_tonumber(L, 2); if(lua_isnumber(L, 3)) compress = lua_tonumber(L, 3); MapNode n = env->getMap().getNodeNoEx(pos); if(n.getContent() == CONTENT_IGNORE){ lua_pushnumber(L, 0); return 1; } lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level, compress)); env->setNode(pos, n); return 1; }