summaryrefslogtreecommitdiffstats
path: root/source/Entity.h
diff options
context:
space:
mode:
authorkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-22 07:33:10 +0100
committerkeyboard.osh@gmail.com <keyboard.osh@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-22 07:33:10 +0100
commit39e4bd323914143408120fc914fd1c52557baac6 (patch)
tree434530690980e923d6b989b494e9fa9a4c6699ac /source/Entity.h
parentDelayedFluidSimulator: optimized block storage for large amounts of blocks. (diff)
downloadcuberite-39e4bd323914143408120fc914fd1c52557baac6.tar
cuberite-39e4bd323914143408120fc914fd1c52557baac6.tar.gz
cuberite-39e4bd323914143408120fc914fd1c52557baac6.tar.bz2
cuberite-39e4bd323914143408120fc914fd1c52557baac6.tar.lz
cuberite-39e4bd323914143408120fc914fd1c52557baac6.tar.xz
cuberite-39e4bd323914143408120fc914fd1c52557baac6.tar.zst
cuberite-39e4bd323914143408120fc914fd1c52557baac6.zip
Diffstat (limited to 'source/Entity.h')
-rw-r--r--source/Entity.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/source/Entity.h b/source/Entity.h
index cdcf57a98..b7789c627 100644
--- a/source/Entity.h
+++ b/source/Entity.h
@@ -127,13 +127,16 @@ public:
void SetPosY (double a_PosY);
void SetPosZ (double a_PosZ);
void SetPosition(double a_PosX, double a_PosY, double a_PosZ);
- void SetPosition(const Vector3d & a_Pos);
+ void SetPosition(const Vector3d & a_Pos) { SetPosition(a_Pos.x,a_Pos.y,a_Pos.z);}
void SetRot (const Vector3f & a_Rot);
void SetRotation(double a_Rotation);
void SetPitch (double a_Pitch);
void SetRoll (double a_Roll);
void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ);
- void SetSpeed (const Vector3d & a_Speed) { m_Speed = a_Speed; }
+ 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);
void AddSpeed(const Vector3d & a_AddSpeed);
@@ -153,6 +156,9 @@ public:
Needs to have a default implementation due to Lua bindings.
*/
virtual void SpawnOn(cClientHandle & a_Client) {ASSERT(!"SpawnOn() unimplemented!"); }
+
+ //Updates clients of changes in the entity.
+ virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = NULL);
/// Attaches to the specified entity; detaches from any previous one first
void AttachTo(cEntity * a_AttachTo);
@@ -160,7 +166,11 @@ public:
/// Detaches from the currently attached entity, if any
void Detach(void);
+ //Makes sure rotation is not over the specified range.
void WrapRotation();
+
+ //Makes speed is not over 20. Max speed is 20 blocks / second
+ void WrapSpeed();
// tolua_begin
@@ -192,13 +202,17 @@ protected:
cReferenceManager* m_References;
int m_ChunkX, m_ChunkY, m_ChunkZ;
- Vector3d m_Pos;
+
+ //Flags that signal that we haven't updated the clients with the latest.
+ bool m_bDirtyOrientation;
bool m_bDirtyPosition;
+ bool m_bDirtySpeed;
- Vector3d m_Rot;
- bool m_bDirtyOrientation;
-
- Vector3d m_Speed;
+ //Last Position.
+ double m_LastPosX, m_LastPosY, m_LastPosZ;
+
+ //This variables keep track of the last time a packet was sent
+ Int64 m_TimeLastTeleportPacket,m_TimeLastMoveReltPacket,m_TimeLastSpeedPacket; // In ticks
bool m_bDestroyed;
bool m_bRemovedFromChunk;
@@ -219,6 +233,10 @@ protected:
void AddReference( cEntity*& a_EntityPtr );
void ReferencedBy( cEntity*& a_EntityPtr );
void Dereference( cEntity*& a_EntityPtr );
+private:
+ Vector3d m_Speed;
+ Vector3d m_Rot;
+ Vector3d m_Pos;
} ; // tolua_export
typedef std::list<cEntity *> cEntityList;