diff options
author | madmaxoft <github@xoft.cz> | 2014-06-14 17:10:53 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-06-14 17:10:53 +0200 |
commit | 3f009a7c9e35a08d5685cd4276e17fc8f3443f9e (patch) | |
tree | 2690eca907fe5d28ee3dcbabaedaacc21e23d8a1 /src/Entities/Entity.h | |
parent | Merge branch 'master' into cPlayerSetSpeed (diff) | |
download | cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar.gz cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar.bz2 cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar.lz cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar.xz cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.tar.zst cuberite-3f009a7c9e35a08d5685cd4276e17fc8f3443f9e.zip |
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r-- | src/Entities/Entity.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index fed856b30..cb35db43b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -217,21 +217,21 @@ public: void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180) // tolua_end - /** Measured in meter/second (m/s) */ - Vector3d m_Speed; - // tolua_begin - /** Sets the speed of the entity and moves them in the given speed. */ - virtual void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ); - /** Sets the speed of the entity and moves them in the given speed. */ - void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } - - /** Sets the speed for the X axis */ - virtual void SetSpeedX (double a_SpeedX); - /** Sets the speed for the Y axis */ - virtual void SetSpeedY (double a_SpeedY); - /** Sets the speed for the Z axis */ - virtual void SetSpeedZ (double a_SpeedZ); + /** Sets the speed of the entity, measured in m / sec */ + void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ); + + /** Sets the speed of the entity, measured in m / sec */ + void SetSpeed(const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); } + + /** Sets the speed in the X axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedX(double a_SpeedX); + + /** Sets the speed in the Y axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedY(double a_SpeedY); + + /** Sets the speed in the Z axis, leaving the other speed components intact. Measured in m / sec. */ + void SetSpeedZ(double a_SpeedZ); void SetWidth (double a_Width); @@ -442,6 +442,9 @@ protected: static cCriticalSection m_CSCount; static int m_EntityCount; + /** Measured in meter/second (m/s) */ + Vector3d m_Speed; + int m_UniqueID; int m_Health; @@ -499,11 +502,15 @@ protected: /// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. int m_TicksSinceLastVoidDamage; - + + /** Does the actual speed-setting. The default implementation just sets the member variable value; + overrides can provide further processing, such as forcing players to move at the given speed. */ + virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ); + virtual void Destroyed(void) {} // Called after the entity has been destroyed /** Called in each tick to handle air-related processing i.e. drowning */ - virtual void HandleAir(); + virtual void HandleAir(void); /** Called once per tick to set IsSwimming and IsSubmerged */ virtual void SetSwimState(cChunk & a_Chunk); |