summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Player.h')
-rw-r--r--src/Entities/Player.h47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index bf3ca08e8..50f7560d6 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -13,6 +13,7 @@
class cGroup;
class cWindow;
class cClientHandle;
+class cTeam;
@@ -30,8 +31,6 @@ 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
@@ -153,6 +152,15 @@ public:
AString GetIP(void) const { return m_IP; } // tolua_export
+ /// Returns the associated team, NULL if none
+ cTeam * GetTeam(void) { return m_Team; } // tolua_export
+
+ /// Sets the player team, NULL if none
+ void SetTeam(cTeam * a_Team);
+
+ /// Forces the player to query the scoreboard for his team
+ cTeam * UpdateTeam(void);
+
// tolua_end
void SetIP(const AString & a_IP);
@@ -214,7 +222,14 @@ public:
/// Returns the full color code to use for this player, based on their primary group or set in m_Color
AString GetColor(void) const;
- void TossItem(bool a_bDraggingItem, char a_Amount = 1, short a_CreateType = 0, short a_CreateHealth = 0);
+ /** tosses the item in the selected hotbar slot */
+ void TossEquippedItem(char a_Amount = 1);
+
+ /** tosses the item held in hand (when in UI windows) */
+ void TossHeldItem(char a_Amount = 1);
+
+ /** tosses a pickup newly created from a_Item */
+ void TossPickup(const cItem & a_Item);
/// Heals the player by the specified amount of HPs (positive only); sends health update
void Heal(int a_Health);
@@ -224,8 +239,6 @@ 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); }
@@ -336,12 +349,6 @@ public:
/// If true the player can fly even when he's not in creative.
void SetCanFly(bool a_CanFly);
- /// 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; }
-
/// Returns wheter the player can fly or not.
virtual bool CanFly(void) const { return m_CanFly; }
// tolua_end
@@ -372,12 +379,6 @@ protected:
XP_TO_LEVEL30 = 825
} ;
- /// 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:
@@ -414,7 +415,7 @@ protected:
float m_LastBlockActionTime;
int m_LastBlockActionCnt;
eGameMode m_GameMode;
- std::string m_IP;
+ AString m_IP;
/// The item being dragged by the cursor while in a UI window
cItem m_DraggingItem;
@@ -456,6 +457,8 @@ protected:
int m_FloaterID;
+ cTeam* m_Team;
+
void ResolvePermissions(void);
@@ -463,7 +466,7 @@ protected:
virtual void Destroyed(void);
- /// Filters out damage for creative mode
+ /// Filters out damage for creative mode/friendly fire
virtual void DoTakeDamage(TakeDamageInfo & TDI) override;
/// Called in each tick to handle food-related processing
@@ -471,12 +474,6 @@ protected:
/// Called in each tick if the player is fishing to make sure the floater dissapears when the player doesn't have a fishing rod as equipped item.
void HandleFloater(void);
-
- /// Called in each tick to handle air-related processing i.e. drowning
- 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();