diff options
-rw-r--r-- | src/Entities/Entity.h | 13 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 20 | ||||
-rw-r--r-- | src/Entities/Player.h | 5 |
3 files changed, 32 insertions, 6 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0c393c0f5..0ea27ef10 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -214,8 +214,14 @@ public: void SetYaw (double a_Yaw); // In degrees, normalizes to [-180, +180) void SetPitch (double a_Pitch); // In degrees, normalizes to [-180, +180) void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180) - void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); - void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } + // tolua_end + + /** Measured in meter/second (m/s) */ + Vector3d m_Speed; + + // 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); @@ -504,9 +510,6 @@ private: /** Measured in degrees, [-180, +180) */ double m_HeadYaw; - /** Measured in meter/second (m/s) */ - Vector3d m_Speed; - /** Measured in degrees, [-180, +180) */ Vector3d m_Rot; diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c3b763278..48320b6c9 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1252,6 +1252,26 @@ 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); + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + +void cPlayer::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) +{ + m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ); + m_ClientHandle->SendEntityVelocity(*this); +} + + + + + void cPlayer::MoveTo( const Vector3d & a_NewPos ) { if ((a_NewPos.y < -990) && (GetPosY() > -100)) diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 78b534d83..43f27e045 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -191,9 +191,12 @@ public: // Sets the current gamemode, doesn't check validity, doesn't send update packets to client void LoginSetGameMode(eGameMode a_GameMode); - /** Forces the player to move in the given direction. */ + /** Forces the player to move in the given direction. DEPRECATED! Use SetSpeed instead */ 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 + /** Tries to move to a new position, with attachment-related checks (y == -999) */ void MoveTo(const Vector3d & a_NewPos); // tolua_export |