summaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2018-08-05 22:28:41 +0200
committerParamat <paramat@users.noreply.github.com>2018-08-05 21:28:41 +0100
commitee63b94f2c9e176f549c4446391e4c59f5a5be53 (patch)
tree767f643bf1849b521646ed0ca41c323efd384a7a /src/content_sao.cpp
parent88efebdf864baeb422cbe4d992a44ff7c99373fb (diff)
downloadminetest-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.cpp')
-rw-r--r--src/content_sao.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 4ef52c7f2..f32294191 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -118,15 +118,14 @@ UnitSAO::UnitSAO(ServerEnvironment *env, v3f pos):
m_armor_groups["fleshy"] = 100;
}
-bool UnitSAO::isAttached() const
+ServerActiveObject *UnitSAO::getParent() const
{
if (!m_attachment_parent_id)
- return false;
+ return nullptr;
// Check if the parent still exists
ServerActiveObject *obj = m_env->getActiveObject(m_attachment_parent_id);
- if (obj)
- return true;
- return false;
+
+ return obj;
}
void UnitSAO::setArmorGroups(const ItemGroupList &armor_groups)