mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Use swapNode for set_node_level and add_node_level
While this is a behaviour change I don't think the old one made any sense. It's possible that someone hit this before and wrote a workaround for it, they won't be affected by this change. It only makes things work that didn't before.
This commit is contained in:
parent
62629939ff
commit
610578e3e2
@ -541,7 +541,7 @@ int ModApiEnvMod::l_set_node_level(lua_State *L)
|
|||||||
level = lua_tonumber(L, 2);
|
level = lua_tonumber(L, 2);
|
||||||
MapNode n = env->getMap().getNode(pos);
|
MapNode n = env->getMap().getNode(pos);
|
||||||
lua_pushnumber(L, n.setLevel(env->getGameDef()->ndef(), level));
|
lua_pushnumber(L, n.setLevel(env->getGameDef()->ndef(), level));
|
||||||
env->setNode(pos, n);
|
env->swapNode(pos, n);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ int ModApiEnvMod::l_add_node_level(lua_State *L)
|
|||||||
level = lua_tonumber(L, 2);
|
level = lua_tonumber(L, 2);
|
||||||
MapNode n = env->getMap().getNode(pos);
|
MapNode n = env->getMap().getNode(pos);
|
||||||
lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level));
|
lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level));
|
||||||
env->setNode(pos, n);
|
env->swapNode(pos, n);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user