From 0224a4f7fc17400dd100a2333c7bbf9c898426c4 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 7 Jul 2013 14:13:43 +0000 Subject: Fixed sprinting in 1.6.1, made speeds available through API; fixed messages containing quotes. Fixes FS #415 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1660 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Player.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'source/Player.h') diff --git a/source/Player.h b/source/Player.h index 639b2595b..ea293297a 100644 --- a/source/Player.h +++ b/source/Player.h @@ -171,11 +171,34 @@ public: /// Returns the list of slots currently stored for inventory painting. To be used by cWindow only const cSlotNums & GetInventoryPaintSlots(void) const; + // tolua_begin + + /// Returns the current maximum speed, as reported in the 1.6.1+ protocol (takes current sprinting state into account) + double GetMaxSpeed(void) const; + + /// Gets the normal maximum speed, as reported in the 1.6.1+ protocol, in the protocol units + double GetNormalMaxSpeed(void) const { return m_NormalMaxSpeed; } + + /// Gets the sprinting maximum speed, as reported in the 1.6.1+ protocol, in the protocol units + double GetSprintingMaxSpeed(void) const { return m_SprintingMaxSpeed; } + + /// Sets the normal maximum speed, as reported in the 1.6.1+ protocol. Sends the update to player, if needed. + void SetNormalMaxSpeed(double a_Speed); + + /// Sets the sprinting maximum speed, as reported in the 1.6.1+ protocol. Sends the update to player, if needed. + void SetSprintingMaxSpeed(double a_Speed); + /// Sets the crouch status, broadcasts to all visible players void SetCrouch(bool a_IsCrouched); + /// Starts or stops sprinting, sends the max speed update to the client, if needed + void SetSprint(bool a_IsSprinting); + + // tolua_end + // cEntity overrides: - virtual bool IsCrouched(void) const { return m_IsCrouched; } + virtual bool IsCrouched (void) const { return m_IsCrouched; } + virtual bool IsSprinting(void) const { return m_IsSprinting; } protected: typedef std::map< std::string, bool > PermissionMap; @@ -226,7 +249,14 @@ protected: cSlotNums m_InventoryPaintSlots; + /// Max speed, in ENTITY_PROPERTIES packet's units, when the player is walking. 0.1 by default + double m_NormalMaxSpeed; + + /// Max speed, in ENTITY_PROPERTIES packet's units, when the player is sprinting. 0.13 by default + double m_SprintingMaxSpeed; + bool m_IsCrouched; + bool m_IsSprinting; virtual void Destroyed(void); -- cgit v1.2.3