summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.h6
-rw-r--r--src/Entities/Player.cpp45
-rw-r--r--src/Entities/Player.h6
3 files changed, 53 insertions, 4 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 0ea27ef10..fc72462c3 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -222,9 +222,9 @@ public:
// tolua_begin
virtual void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ);
virtual void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); }
- void SetSpeedX (double a_SpeedX);
- void SetSpeedY (double a_SpeedY);
- void SetSpeedZ (double a_SpeedZ);
+ virtual void SetSpeedX (double a_SpeedX);
+ virtual void SetSpeedY (double a_SpeedY);
+ virtual void SetSpeedZ (double a_SpeedZ);
void SetWidth (double a_Width);
void AddPosX (double a_AddPosX);
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 48320b6c9..0d79ff533 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1255,6 +1255,9 @@ void cPlayer::ForceSetSpeed(const Vector3d & a_Speed)
void cPlayer::SetSpeed(const Vector3d & a_Speed)
{
m_Speed.Set(a_Speed.x, a_Speed.y, a_Speed.z);
+ WrapSpeed();
+
+ // Send the speed to the client so he actualy moves
m_ClientHandle->SendEntityVelocity(*this);
}
@@ -1265,6 +1268,48 @@ void cPlayer::SetSpeed(const Vector3d & a_Speed)
void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
{
m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ);
+ WrapSpeed();
+
+ // Send the speed to the client so he actualy moves
+ m_ClientHandle->SendEntityVelocity(*this);
+}
+
+
+
+
+
+void cPlayer::SetSpeedX(double a_SpeedX)
+{
+ m_Speed.x = a_SpeedX;
+ WrapSpeed();
+
+ // Send the speed to the client so he actualy moves
+ m_ClientHandle->SendEntityVelocity(*this);
+}
+
+
+
+
+
+void cPlayer::SetSpeedY(double a_SpeedY)
+{
+ m_Speed.y = a_SpeedY;
+ WrapSpeed();
+
+ // Send the speed to the client so he actualy moves
+ m_ClientHandle->SendEntityVelocity(*this);
+}
+
+
+
+
+
+void cPlayer::SetSpeedZ(double a_SpeedZ)
+{
+ m_Speed.z = a_SpeedZ;
+ WrapSpeed();
+
+ // Send the speed to the client so he actualy moves
m_ClientHandle->SendEntityVelocity(*this);
}
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 43f27e045..fb6bdc3ee 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -195,7 +195,11 @@ public:
void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export
virtual void SetSpeed(const Vector3d & a_Speed) override;
- virtual void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override
+ virtual void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override;
+
+ virtual void SetSpeedX(double a_SpeedX) override;
+ virtual void SetSpeedY(double a_SpeedY) override;
+ virtual void SetSpeedZ(double a_SpeedZ) override;
/** Tries to move to a new position, with attachment-related checks (y == -999) */
void MoveTo(const Vector3d & a_NewPos); // tolua_export