summaryrefslogtreecommitdiffstats
path: root/source/Entities/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-30 14:32:07 +0200
committermadmaxoft <github@xoft.cz>2013-08-30 14:32:07 +0200
commitc28ccdc9d56497d42c2a97554a96de76e0d2ee68 (patch)
treef1a1f5629ae7e2565330580ab4e6fe76466acf6e /source/Entities/Player.cpp
parentAdded the login sequence of a vanilla client to the docs. (diff)
parentShooting a bow kinda works. (diff)
downloadcuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar.gz
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar.bz2
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar.lz
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar.xz
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.tar.zst
cuberite-c28ccdc9d56497d42c2a97554a96de76e0d2ee68.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Player.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp
index 119afbafc..0cb047933 100644
--- a/source/Entities/Player.cpp
+++ b/source/Entities/Player.cpp
@@ -64,6 +64,8 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
, m_IsSwimming(false)
, m_IsSubmerged(false)
, m_EatingFinishTick(-1)
+ , m_IsChargingBow(false)
+ , m_BowCharge(0)
{
LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d",
a_PlayerName.c_str(), a_Client->GetIPString().c_str(),
@@ -213,6 +215,13 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
// Handle air drowning stuff
HandleAir();
+
+ // Handle charging the bow:
+ if (m_IsChargingBow)
+ {
+ m_BowCharge += 1;
+ LOGD("Player \"%s\" charging bow: %d", m_PlayerName.c_str(), m_BowCharge);
+ }
if (m_bDirtyPosition)
{
@@ -253,6 +262,41 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
+void cPlayer::StartChargingBow(void)
+{
+ LOGD("Player \"%s\" started charging their bow", m_PlayerName.c_str());
+ m_IsChargingBow = true;
+ m_BowCharge = 0;
+}
+
+
+
+
+
+int cPlayer::FinishChargingBow(void)
+{
+ LOGD("Player \"%s\" finished charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge);
+ int res = m_BowCharge;
+ m_IsChargingBow = false;
+ m_BowCharge = 0;
+ return res;
+}
+
+
+
+
+
+void cPlayer::CancelChargingBow(void)
+{
+ LOGD("Player \"%s\" cancelled charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge);
+ m_IsChargingBow = false;
+ m_BowCharge = 0;
+}
+
+
+
+
+
void cPlayer::SetTouchGround(bool a_bTouchGround)
{
// If just