diff options
Diffstat (limited to '')
-rw-r--r-- | source/ClientHandle.cpp | 19 | ||||
-rw-r--r-- | source/ClientHandle.h | 5 |
2 files changed, 20 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 diff --git a/source/ClientHandle.h b/source/ClientHandle.h index ec79b3b71..cefbbd5d8 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -223,6 +223,11 @@ private: int m_BlockDigY; int m_BlockDigZ; + char m_LastDigStatus; + int m_LastDigX; + int m_LastDigY; + int m_LastDigZ; + enum eState { csConnected, // The client has just connected, waiting for their handshake / login |