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/content_sao.cpp | |
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/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index bf8282af4..d6581144f 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -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); |