summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-25 00:58:51 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-01-25 00:58:51 +0100
commitfd7fc7e59efebd6b28012c8e8433f53ac853c555 (patch)
treefa4379ca71f8bd716be09bf2daad914e8649a277 /src/Entities/Entity.h
parentFixed a generator bug (diff)
downloadcuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar.gz
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar.bz2
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar.lz
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar.xz
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.tar.zst
cuberite-fd7fc7e59efebd6b28012c8e8433f53ac853c555.zip
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r--src/Entities/Entity.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 62dc42c3f..f6fa58bb2 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -110,6 +110,8 @@ public:
BURN_TICKS_PER_DAMAGE = 20, ///< How many ticks to wait between damaging an entity when it is burning
BURN_DAMAGE = 1, ///< How much damage to deal when the entity is burning
BURN_TICKS = 200, ///< How long to keep an entity burning after it has stood in lava / fire
+ MAX_AIR_LEVEL = 300, ///< Maximum air an entity can have
+ DROWNING_TICKS = 20, ///< Number of ticks per heart of damage
} ;
cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, double a_Width, double a_Height);
@@ -344,7 +346,14 @@ public:
virtual bool IsRiding (void) const {return false; }
virtual bool IsSprinting(void) const {return false; }
virtual bool IsRclking (void) const {return false; }
- virtual bool IsInvisible(void) const {return false; }
+ virtual bool IsInvisible(void) const { return false; }
+
+ /** Returns whether the player is swimming or not */
+ virtual bool IsSwimming(void) const{ return m_IsSwimming; }
+ /** Return whether the player is under water or not */
+ virtual bool IsSubmerged(void) const{ return m_IsSubmerged; }
+ /** Gets remaining air of a monster */
+ int GetAirLevel(void) const { return m_AirLevel; }
// tolua_end
@@ -412,6 +421,18 @@ protected:
virtual void Destroyed(void) {} // Called after the entity has been destroyed
void SetWorld(cWorld * a_World) { m_World = a_World; }
+
+ /** Called in each tick to handle air-related processing i.e. drowning */
+ virtual void HandleAir();
+ /** Called once per tick to set IsSwimming and IsSubmerged */
+ virtual void SetSwimState(cChunk & a_Chunk);
+
+ /** If an entity is currently swimming in or submerged under water */
+ bool m_IsSwimming, m_IsSubmerged;
+
+ /** Air level of a mobile */
+ int m_AirLevel;
+ int m_AirTickTimer;
private:
// Measured in degrees, [-180, +180)