From 72535d33281ed4c863013590e5fd032c39f0b781 Mon Sep 17 00:00:00 2001 From: red-001 Date: Sat, 21 Jan 2017 15:11:55 +0000 Subject: Detach the player from entities on death. (#5077) --- src/script/lua_api/l_object.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/script') diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 59c04f301..f579c0b86 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -710,20 +710,7 @@ int ObjectRef::l_set_detach(lua_State *L) ServerActiveObject *co = getobject(ref); if (co == NULL) return 0; - - int parent_id = 0; - std::string bone = ""; - v3f position; - v3f rotation; - co->getAttachment(&parent_id, &bone, &position, &rotation); - ServerActiveObject *parent = NULL; - if (parent_id) - parent = env->getActiveObject(parent_id); - - // Do it - co->setAttachment(0, "", v3f(0,0,0), v3f(0,0,0)); - if (parent != NULL) - parent->removeAttachmentChild(co->getId()); + co->detachFromParent(); return 0; } -- cgit v1.2.3