diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-08-05 22:28:41 +0200 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-08-05 21:28:41 +0100 |
commit | ee63b94f2c9e176f549c4446391e4c59f5a5be53 (patch) | |
tree | 767f643bf1849b521646ed0ca41c323efd384a7a /src/content_sao.h | |
parent | 88efebdf864baeb422cbe4d992a44ff7c99373fb (diff) | |
download | minetest-ee63b94f2c9e176f549c4446391e4c59f5a5be53.tar.gz minetest-ee63b94f2c9e176f549c4446391e4c59f5a5be53.tar.bz2 minetest-ee63b94f2c9e176f549c4446391e4c59f5a5be53.zip |
Prevent objects from colliding with own child attachments (#7610)
Also, use a better distance calculation for 'collide with objects'.
Fixes the issue of a vehicle occasionally colliding with its own driver,
causing one of the velocity components to be set to zero.
Diffstat (limited to 'src/content_sao.h')
-rw-r--r-- | src/content_sao.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/content_sao.h b/src/content_sao.h index 8510015c5..e45a4028e 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -42,7 +42,9 @@ public: // Use a function, if isDead can be defined by other conditions bool isDead() const { return m_hp == 0; } - bool isAttached() const; + inline bool isAttached() const + { return getParent(); } + void setArmorGroups(const ItemGroupList &armor_groups); const ItemGroupList &getArmorGroups(); void setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop); @@ -57,6 +59,7 @@ public: void addAttachmentChild(int child_id); void removeAttachmentChild(int child_id); const std::unordered_set<int> &getAttachmentChildIds(); + ServerActiveObject *getParent() const; ObjectProperties* accessObjectProperties(); void notifyObjectPropertiesModified(); protected: |