summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTycho Bickerstaff <work.tycho@gmail.com>2013-12-18 20:06:11 +0100
committerTycho Bickerstaff <work.tycho@gmail.com>2013-12-18 20:06:11 +0100
commite627f2f98cb9a2ec7cddcaac779350abcbae414a (patch)
tree6101aa8aa5a0152c278e129a26ba7ca26172597c /src/Entities/Entity.cpp
parentadded zlib (diff)
parentMerge pull request #440 from mc-server/repeaterfixes (diff)
downloadcuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar.gz
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar.bz2
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar.lz
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar.xz
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.tar.zst
cuberite-e627f2f98cb9a2ec7cddcaac779350abcbae414a.zip
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 0a2145e81..7721d58b3 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1341,6 +1341,19 @@ void cEntity::AddSpeedZ(double a_AddSpeedZ)
+void cEntity::HandleSpeedFromAttachee(float a_Forward, float a_Sideways)
+{
+ Vector3d LookVector = m_Attachee->GetLookVector();
+ double AddSpeedX = LookVector.x * a_Forward + LookVector.z * a_Sideways;
+ double AddSpeedZ = LookVector.z * a_Forward - LookVector.x * a_Sideways;
+ SetSpeed(AddSpeedX, 0, AddSpeedZ);
+ BroadcastMovementUpdate();
+}
+
+
+
+
+
void cEntity::SteerVehicle(float a_Forward, float a_Sideways)
{
if (m_AttachedTo == NULL)
@@ -1349,10 +1362,7 @@ void cEntity::SteerVehicle(float a_Forward, float a_Sideways)
}
if ((a_Forward != 0) || (a_Sideways != 0))
{
- Vector3d LookVector = GetLookVector();
- double AddSpeedX = LookVector.x * a_Forward + LookVector.z * a_Sideways;
- double AddSpeedZ = LookVector.z * a_Forward - LookVector.x * a_Sideways;
- m_AttachedTo->AddSpeed(AddSpeedX, 0, AddSpeedZ);
+ m_AttachedTo->HandleSpeedFromAttachee(a_Forward, a_Sideways);
}
}