summaryrefslogtreecommitdiffstats
path: root/source/ClientHandle.cpp
diff options
context:
space:
mode:
authorluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-12 12:10:01 +0100
committerluksor111@gmail.com <luksor111@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-12 12:10:01 +0100
commitf32091f98c90e2f9a0786a8865e010880a584e7a (patch)
tree5380d34dfbfaabe837561de3feafe3749185b1ac /source/ClientHandle.cpp
parentAdded DeadBushes finisher (initial patch by STR_Warrior; DeathBushes FTW!) (diff)
downloadcuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.gz
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.bz2
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.lz
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.xz
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.tar.zst
cuberite-f32091f98c90e2f9a0786a8865e010880a584e7a.zip
Diffstat (limited to 'source/ClientHandle.cpp')
-rw-r--r--source/ClientHandle.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp
index fd7ad917e..d677065a4 100644
--- a/source/ClientHandle.cpp
+++ b/source/ClientHandle.cpp
@@ -90,6 +90,7 @@ cClientHandle::cClientHandle(const cSocket * a_Socket, int a_ViewDistance)
, m_ShouldCheckDownloaded(false)
, m_UniqueID(0)
, m_BlockDigAnim(-1)
+ , m_LastDigStatus(-1)
{
m_Protocol = new cProtocolRecognizer(this);
@@ -508,8 +509,8 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha
return;
}
- LOGD("OnBlockDig: {%i, %i, %i}; Face: %i; Stat: %i",
- a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status
+ LOGD("OnBlockDig: {%i, %i, %i}; Face: %i; Stat: %i LastStat: %i",
+ a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status, m_LastDigStatus
);
// Do we want plugins to disable tossing items? Probably no, so toss item before asking plugins for permission
@@ -536,13 +537,23 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha
World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player);
return;
}
-
+
bool bBroken = (
- (a_Status == DIG_STATUS_FINISHED) ||
+ ((a_Status == DIG_STATUS_FINISHED) &&
+ //Don't allow to finish digging if not started yet:
+ (m_LastDigStatus == 0) &&
+ (m_LastDigX == a_BlockX) &&
+ (m_LastDigY == a_BlockY) &&
+ (m_LastDigZ == a_BlockZ)) ||
(g_BlockOneHitDig[(int)OldBlock]) ||
((a_Status == DIG_STATUS_STARTED) && (m_Player->GetGameMode() == 1))
);
+ m_LastDigStatus = a_Status;
+ m_LastDigX = a_BlockX;
+ m_LastDigY = a_BlockY;
+ m_LastDigZ = a_BlockZ;
+
if ((a_Status == DIG_STATUS_STARTED) && (m_Player->GetGameMode() != eGameMode_Creative))
{
// Start dig animation