From 610578e3e214bb16d471d7b7ab0e675888fe8e9c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 17 Jun 2023 15:56:52 +0200 Subject: [PATCH] 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. --- src/script/lua_api/l_env.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index a61b8e0b3999..c5a2d41e642b 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -541,7 +541,7 @@ int ModApiEnvMod::l_set_node_level(lua_State *L) level = lua_tonumber(L, 2); MapNode n = env->getMap().getNode(pos); lua_pushnumber(L, n.setLevel(env->getGameDef()->ndef(), level)); - env->setNode(pos, n); + env->swapNode(pos, n); return 1; } @@ -558,7 +558,7 @@ int ModApiEnvMod::l_add_node_level(lua_State *L) level = lua_tonumber(L, 2); MapNode n = env->getMap().getNode(pos); lua_pushnumber(L, n.addLevel(env->getGameDef()->ndef(), level)); - env->setNode(pos, n); + env->swapNode(pos, n); return 1; }