From 4746d2251c6204118e710c818d78b89c356a7427 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 28 Jul 2013 19:15:03 +0200 Subject: Implemented basic eating support. Food is now properly consumed and it takes 1.5 sec. --- source/Player.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/Player.h') diff --git a/source/Player.h b/source/Player.h index 69b0c3df1..093c35b44 100644 --- a/source/Player.h +++ b/source/Player.h @@ -28,6 +28,7 @@ public: { MAX_HEALTH = 20, MAX_FOOD_LEVEL = 20, + EATING_TICKS = 30, ///< Number of ticks it takes to eat an item } ; // tolua_end @@ -164,6 +165,15 @@ public: // tolua_end + /// Starts eating the currently equipped item. Resets the eating timer and sends the proper animation packet + void StartEating(void); + + /// Finishes eating the currently equipped item. Consumes the item, updates health and broadcasts the packets + void FinishEating(void); + + /// Aborts the current eating operation + void AbortEating(void); + virtual void KilledBy(cEntity * a_Killer) override; void Respawn(void); // tolua_export @@ -296,6 +306,9 @@ protected: bool m_IsCrouched; bool m_IsSprinting; + /// The world tick in which eating will be finished. -1 if not eating + Int64 m_EatingFinishTick; + virtual void Destroyed(void); -- cgit v1.2.3