summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Entities/Entity.cpp18
-rw-r--r--src/Entities/Entity.h1
2 files changed, 15 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);
}
}
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index de5f176ae..8d1692c98 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -197,6 +197,7 @@ public:
void AddSpeedY (double a_AddSpeedY);
void AddSpeedZ (double a_AddSpeedZ);
+ virtual void HandleSpeedFromAttachee(float a_Forward, float a_Sideways);
void SteerVehicle(float a_Forward, float a_Sideways);
inline int GetUniqueID(void) const { return m_UniqueID; }