summaryrefslogtreecommitdiffstats
path: root/source/Player.h
diff options
context:
space:
mode:
authorJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 11:32:34 +0200
committerJames Ravenscroft <ravenscroftj@gmail.com>2013-08-08 11:32:34 +0200
commite6c33b0256b7dc0569aff36005eb24dab4ca0244 (patch)
treec9af2c9010043685479779bb6be61d75019fd85a /source/Player.h
parentAddeed OnSpawningEntity, OnSpawnedEntity, OnSpawningMonster, OnSpawnedMonster hooks. (diff)
downloadcuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar.gz
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar.bz2
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar.lz
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar.xz
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.tar.zst
cuberite-e6c33b0256b7dc0569aff36005eb24dab4ca0244.zip
Diffstat (limited to 'source/Player.h')
-rw-r--r--source/Player.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/Player.h b/source/Player.h
index c8d66b842..c0fe31863 100644
--- a/source/Player.h
+++ b/source/Player.h
@@ -29,6 +29,8 @@ public:
MAX_HEALTH = 20,
MAX_FOOD_LEVEL = 20,
EATING_TICKS = 30, ///< Number of ticks it takes to eat an item
+ MAX_AIR_LEVEL = 300,
+ DROWNING_TICKS = 10, //number of ticks per heart of damage
} ;
// tolua_end
@@ -160,6 +162,8 @@ public:
int GetFoodTickTimer (void) const { return m_FoodTickTimer; }
double GetFoodExhaustionLevel (void) const { return m_FoodExhaustionLevel; }
int GetFoodPoisonedTicksRemaining(void) const { return m_FoodPoisonedTicksRemaining; }
+
+ int GetAirLevel (void) const { return m_AirLevel; }
/// Returns true if the player is satiated, i. e. their foodlevel is at the max and they cannot eat anymore
bool IsSatiated(void) const { return (m_FoodLevel >= MAX_FOOD_LEVEL); }
@@ -267,6 +271,11 @@ protected:
std::string m_PlayerName;
std::string m_LoadedWorldName;
+ //Player's air level (for swimming)
+ int m_AirLevel;
+ //used to time ticks between damage taken via drowning/suffocation
+ int m_AirTickTimer;
+
bool m_bVisible;
// Food-related variables:
@@ -329,7 +338,6 @@ protected:
/// The world tick in which eating will be finished. -1 if not eating
Int64 m_EatingFinishTick;
-
virtual void Destroyed(void);
/// Filters out damage for creative mode
@@ -338,6 +346,9 @@ protected:
/// Called in each tick to handle food-related processing
void HandleFood(void);
+ /// Called in each tick to handle air-related processing i.e. drowning
+ void HandleAir(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);
} ; // tolua_export