aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_object.cpp15
1 files changed, 1 insertions, 14 deletions
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;
}