1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Detach the player from entities on death. (#5077)

This commit is contained in:
red-001 2017-01-21 15:11:55 +00:00 committed by Loïc Blot
parent 0eede97af2
commit 72535d3328
5 changed files with 16 additions and 14 deletions

View file

@ -203,6 +203,16 @@ void UnitSAO::getAttachment(int *parent_id, std::string *bone, v3f *position,
*rotation = m_attachment_rotation;
}
void UnitSAO::detachFromParent()
{
ServerActiveObject *parent = NULL;
if (m_attachment_parent_id)
parent = m_env->getActiveObject(m_attachment_parent_id);
setAttachment(NULL, "", v3f(0, 0, 0), v3f(0, 0, 0));
if (parent != NULL)
parent->removeAttachmentChild(m_id);
}
void UnitSAO::addAttachmentChild(int child_id)
{
m_attachment_child_ids.insert(child_id);