summaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp10
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);