aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorshivajiva101 <shivajiva101@hotmail.com>2017-04-29 17:18:46 +0100
committersfan5 <sfan5@live.de>2017-04-29 18:18:46 +0200
commitc729543ec4ab5cba167b97f0b8c796de3de88a26 (patch)
treedb7c642f85fab10e13f6f402a146db0799538acb /src/script/lua_api
parent3251e4493846e981b9dc707c635ee5f966f7d40c (diff)
downloadminetest-c729543ec4ab5cba167b97f0b8c796de3de88a26.tar.gz
minetest-c729543ec4ab5cba167b97f0b8c796de3de88a26.tar.bz2
minetest-c729543ec4ab5cba167b97f0b8c796de3de88a26.zip
Fix visual slide issue with set_detach, fixes #5620
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_object.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 9668f76f7..a5b6e3941 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -726,11 +726,13 @@ int ObjectRef::l_set_detach(lua_State *L)
v3f rotation;
co->getAttachment(&parent_id, &bone, &position, &rotation);
ServerActiveObject *parent = NULL;
- if (parent_id)
+ if (parent_id) {
parent = env->getActiveObject(parent_id);
-
+ co->setAttachment(0, "", position, rotation);
+ } else {
+ co->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0));
+ }
// Do it
- co->setAttachment(0, "", v3f(0,0,0), v3f(0,0,0));
if (parent != NULL)
parent->removeAttachmentChild(co->getId());
return 0;