diff options
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_object.cpp | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 1d0716484..f9498a9a7 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -642,7 +642,7 @@ int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L) std::vector<u16>::const_iterator iter = ids.begin(); for(u32 i = 0; iter != ids.end(); ++iter) { ServerActiveObject *obj = env->getActiveObject(*iter); - if (!obj->m_removed) { + if (!obj->isGone()) { // Insert object reference into table script->objectrefGetOrCreate(L, obj); lua_rawseti(L, -2, ++i); diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 9b312b3ee..4e4901db5 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -140,15 +140,14 @@ int ObjectRef::l_remove(lua_State *L) return 0; const std::unordered_set<int> &child_ids = co->getAttachmentChildIds(); - std::unordered_set<int>::const_iterator it; - for (it = child_ids.begin(); it != child_ids.end(); ++it) { + for (int child_id : child_ids) { // Child can be NULL if it was deleted earlier - if (ServerActiveObject *child = env->getActiveObject(*it)) + if (ServerActiveObject *child = env->getActiveObject(child_id)) child->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); } - verbosestream<<"ObjectRef::l_remove(): id="<<co->getId()<<std::endl; - co->m_removed = true; + verbosestream << "ObjectRef::l_remove(): id=" << co->getId() << std::endl; + co->m_pending_removal = true; return 0; } |