diff options
author | red-001 <red-001@outlook.ie> | 2017-01-21 15:11:55 +0000 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-01-21 16:11:55 +0100 |
commit | 72535d33281ed4c863013590e5fd032c39f0b781 (patch) | |
tree | 7c19e3cbf592bce10bd91566f66489f62d8c1b7d /src/script | |
parent | 0eede97af2927dcda3545192403b0a44f30bcd1f (diff) | |
download | minetest-72535d33281ed4c863013590e5fd032c39f0b781.tar.gz minetest-72535d33281ed4c863013590e5fd032c39f0b781.tar.bz2 minetest-72535d33281ed4c863013590e5fd032c39f0b781.zip |
Detach the player from entities on death. (#5077)
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 15 |
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; } |