summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-01-21 17:30:55 +0100
committerGitHub <noreply@github.com>2017-01-21 17:30:55 +0100
commitbc29e03b597be350fa856b1ae3d8623778a808b3 (patch)
treee43501d0b6edddd83404997e53c38156860f5160 /src/script/lua_api/l_object.cpp
parentb9c1a758a1e987dfb0284c08dd96d4d17114882f (diff)
downloadminetest-bc29e03b597be350fa856b1ae3d8623778a808b3.tar.gz
minetest-bc29e03b597be350fa856b1ae3d8623778a808b3.tar.bz2
minetest-bc29e03b597be350fa856b1ae3d8623778a808b3.zip
Revert "Detach the player from entities on death." (#5087)
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 1fa3663ca..be4451704 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -710,7 +710,20 @@ int ObjectRef::l_set_detach(lua_State *L)
ServerActiveObject *co = getobject(ref);
if (co == NULL)
return 0;
- co->detachFromParent();
+
+ 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());
return 0;
}