diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-10-02 19:11:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-02 19:11:27 +0200 |
commit | 81c2370c8b1a66a279a5ff450c78caf5dfef77bf (patch) | |
tree | dafd49bfa912783985b5a58713805027f06322b4 /src/client/content_cao.cpp | |
parent | 251038e136f22f29999bd938e6c9e9f1a5269243 (diff) | |
download | hax-minetest-server-81c2370c8b1a66a279a5ff450c78caf5dfef77bf.tar.gz hax-minetest-server-81c2370c8b1a66a279a5ff450c78caf5dfef77bf.zip |
Attachments: Fix attachments to temporary removed objects (#8989)
Does not clear the parent's attachment information when the child is deleted locally.
Either it was removed permanently, or just temporary - we don't know, but it's up to the server to send a *detach from child" packet for the parent.
Diffstat (limited to 'src/client/content_cao.cpp')
-rw-r--r-- | src/client/content_cao.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index d7ab8e945..716468402 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -523,7 +523,9 @@ void GenericCAO::removeFromScene(bool permanent) // Should be true when removing the object permanently // and false when refreshing (eg: updating visuals) if (m_env && permanent) { - clearChildAttachments(); + // The client does not know whether this object does re-appear to + // a later time, thus do not clear child attachments. + clearParentAttachment(); } @@ -1330,10 +1332,17 @@ void GenericCAO::updateAttachments() m_attached_to_local = parent && parent->isLocalPlayer(); - if (!parent && m_attachment_parent_id) { - //m_is_visible = false; maybe later. needs better handling - return; - } + /* + Following cases exist: + m_attachment_parent_id == 0 && !parent + This object is not attached + m_attachment_parent_id != 0 && parent + This object is attached + m_attachment_parent_id != 0 && !parent + This object will be attached as soon the parent is known + m_attachment_parent_id == 0 && parent + Impossible case + */ if (!parent) { // Detach or don't attach if (m_matrixnode) { |