From 907ba15fe208f6a8ad37f35652ae3ceac6bb39e9 Mon Sep 17 00:00:00 2001 From: "admin@omencraft.com" Date: Mon, 7 Nov 2011 18:19:38 +0000 Subject: Added Sebi's changes to pistons and item drops. git-svn-id: http://mc-server.googlecode.com/svn/trunk@72 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index c3ed6c3df..b428910d3 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -516,6 +516,16 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) PickupItem.m_ItemID = PickupID; PickupItem.m_ItemHealth = MetaData; PickupItem.m_ItemCount = 1; + if( OldBlock == E_BLOCK_LAPIS_ORE ) { + PickupItem.m_ItemHealth = 4; + PickupItem.m_ItemCount = rand()%5+4; + } + if( OldBlock == E_BLOCK_REDSTONE_ORE || OldBlock == E_BLOCK_REDSTONE_ORE_GLOWING ) { + PickupItem.m_ItemCount = rand()%2+4; + } + if( OldBlock == E_BLOCK_MELON ) { + PickupItem.m_ItemCount = rand()%8+3; + } } if(!cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_BLOCK_DIG, 2, PacketData, m_Player, &PickupItem ) ) { @@ -620,16 +630,19 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) case E_BLOCK_PLACE: { //LOG("TimeP: %f", m_Player->GetLastBlockActionTime() ); - //LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() ); - if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds - LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot)", GetUsername() ); - m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. - break; - } - m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. + //LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() ); + if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds + LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot)", GetUsername() ); + m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. + break; + } + m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time. cPacket_BlockPlace* PacketData = reinterpret_cast(a_Packet); cItem & Equipped = m_Player->GetInventory().GetEquippedItem(); //if( (Equipped.m_ItemID != PacketData->m_ItemType) ) // Not valid + if ( ( m_Player->GetWorld()->GetBlock( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ ) != E_BLOCK_AIR ) && (m_Player->GetGameMode() != 1) ) { //tried to place a block *into* another? + break; //happens when you place a block aiming at side of block like torch or stem + } if( (Equipped.m_ItemID != PacketData->m_ItemType) && (m_Player->GetGameMode() != 1) ) // Not valid { LOGWARN("Player %s tried to place a block that was not selected! (could indicate bot)", GetUsername() ); @@ -776,21 +789,15 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) } else { //printf("transparent not above me\n"); } - //PacketData->m_ItemType = E_BLOCK_REDSTONE_TORCH_ON; UpdateRedstone = true; AddedCurrent = true; - //cRedstone Redstone(m_Player->GetWorld()); - //Redstone.cRedstone::ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, true ); break; } case E_BLOCK_REDSTONE_TORCH_ON: { MetaData = cTorch::DirectionToMetaData( PacketData->m_Direction ); - //PacketData->m_ItemType = E_BLOCK_REDSTONE_TORCH_ON; UpdateRedstone = true; AddedCurrent = false; - //cRedstone Redstone(m_Player->GetWorld()); - //Redstone.cRedstone::ChangeRedstoneTorch( PacketData->m_PosX, PacketData->m_PosY+1, PacketData->m_PosZ, true ); break; } case E_ITEM_REDSTONE_DUST: -- cgit v1.2.3