diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-08-09 10:06:30 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-08-09 10:06:30 +0200 |
commit | 6f2c099f707eb1f9429ca685725e9c0aef273d7c (patch) | |
tree | 5763e0d8fa66b9a3e27517570375bc67b3654176 /source/Player.h | |
parent | Fixed a copypasta error in hook function names. (diff) | |
parent | Fixed some formatting issues I accidentally introduced (diff) | |
download | cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar.gz cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar.bz2 cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar.lz cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar.xz cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.tar.zst cuberite-6f2c099f707eb1f9429ca685725e9c0aef273d7c.zip |
Diffstat (limited to 'source/Player.h')
-rw-r--r-- | source/Player.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/Player.h b/source/Player.h index 542656b5a..105e7d0a1 100644 --- a/source/Player.h +++ b/source/Player.h @@ -253,6 +253,12 @@ public: /// Starts or stops sprinting, sends the max speed update to the client, if needed void SetSprint(bool a_IsSprinting); + /// 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; } + // tolua_end // cEntity overrides: @@ -260,6 +266,8 @@ public: virtual bool IsSprinting(void) const { return m_IsSprinting; } virtual bool IsRclking (void) const { return IsEating(); } + + protected: typedef std::map< std::string, bool > PermissionMap; PermissionMap m_ResolvedPermissions; @@ -335,6 +343,9 @@ protected: bool m_IsCrouched; bool m_IsSprinting; + bool m_IsSwimming; + bool m_IsSubmerged; + /// The world tick in which eating will be finished. -1 if not eating Int64 m_EatingFinishTick; @@ -347,10 +358,13 @@ protected: void HandleFood(void); /// Called in each tick to handle air-related processing i.e. drowning - void HandleAir(cChunk & a_Chunk); + void HandleAir(); + + /// Called once per tick to set IsSwimming and IsSubmerged + void SetSwimState(cChunk & a_Chunk); /// Adds food exhaustion based on the difference between Pos and LastPos, sprinting status and swimming (in water block) - void ApplyFoodExhaustionFromMovement(cChunk & a_Chunk); + void ApplyFoodExhaustionFromMovement(); } ; // tolua_export |