mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Detach the player from entities on death. (#5077)
This commit is contained in:
parent
0eede97af2
commit
72535d3328
5 changed files with 16 additions and 14 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue