1
0
Fork 0

Fixed block breaking in survival.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1038 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
luksor111@gmail.com 2012-11-12 11:10:01 +00:00
parent e8e678e1b7
commit f32091f98c
2 changed files with 20 additions and 4 deletions

View File

@ -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

View File

@ -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