From 4aa9a669cb184b77213e8df82eb20eda5aad9004 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 29 Jul 2019 19:14:07 +0200 Subject: ContentCAO: Fix broken attachments on join (#8701) What happened: 1) Object data is received. Client begins to read the data 2) Client initializes all its children (gob_cmd_update_infant) 3) Children try to attach to parent (yet not added) 4) Parent initializes, is added to the environment And somewhere in between, Irrlicht wrecks up the attachments due to the missing matrix node. The solution here is to: 1) Use the same structure as ServerActiveObject 2) Attach all children after the parent is really initialized --- src/activeobject.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/activeobject.h') diff --git a/src/activeobject.h b/src/activeobject.h index b6a0e67af..a319ef904 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -20,8 +20,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "irr_aabb3d.h" +#include "irr_v3d.h" #include + enum ActiveObjectType { ACTIVEOBJECT_TYPE_INVALID = 0, ACTIVEOBJECT_TYPE_TEST = 1, @@ -98,6 +100,16 @@ public: virtual bool collideWithObjects() const = 0; + + + virtual void setAttachment(int parent_id, const std::string &bone, v3f position, + v3f rotation) {} + virtual void getAttachment(int *parent_id, std::string *bone, v3f *position, + v3f *rotation) const {} + virtual void clearChildAttachments() {} + virtual void clearParentAttachment() {} + virtual void addAttachmentChild(int child_id) {} + virtual void removeAttachmentChild(int child_id) {} protected: u16 m_id; // 0 is invalid, "no id" }; -- cgit v1.2.3