diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-03 01:42:53 +0100 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-03 01:42:53 +0100 |
commit | 39fd1697e434020044a45d4f18ff4e36b09890b8 (patch) | |
tree | 41d493c7c8ff75b4189765ecde5bc4badcba836a /source/cClientHandle.cpp | |
parent | Added New/Invaid State and Thunderbolt packets. For testing purposes it now rains whenever a player opens a workbench and stops when they pen a chest. The rain start/stop in only sent to the sole clientopening the items. (diff) | |
download | cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar.gz cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar.bz2 cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar.lz cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar.xz cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.tar.zst cuberite-39fd1697e434020044a45d4f18ff4e36b09890b8.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 4c09c4309..f8a9ebd21 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -57,6 +57,7 @@ #include "packets/cPacket_EntityEquipment.h"
#include "packets/cPacket_CreateInventoryAction.h"
#include "packets/cPacket_NewInvalidState.h"
+#include "packets/cPacket_Thunderbolt.h" //for testing.
#include "packets/cPacket_UseEntity.h"
#include "packets/cPacket_WindowClose.h"
#include "packets/cPacket_13.h"
@@ -485,8 +486,9 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) break;
case E_BLOCK_DIG:
{
- LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
- LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
+
+ //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.
@@ -603,8 +605,8 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) break;
case E_BLOCK_PLACE:
{
- LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
- LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
+ //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.
@@ -642,10 +644,17 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) {
case E_BLOCK_WORKBENCH:
{
- LOG("WorkBench");
+ ////////////// For testing V
cPacket_NewInvalidState RainPacket;
RainPacket.m_Reason = 1; //begin rain
- Send( RainPacket );
+ Send( RainPacket );
+ //also strike table with lightning for test purposes
+ cPacket_Thunderbolt ThunderboltPacket;
+ ThunderboltPacket.m_xLBPos = PacketData->m_PosX;
+ ThunderboltPacket.m_yLBPos = PacketData->m_PosY;
+ ThunderboltPacket.m_zLBPos = PacketData->m_PosZ;
+ Send( ThunderboltPacket );
+ ////////////// For testing ^
bPlaceBlock = false;
cWindow* Window = new cCraftingWindow( 0, true );
m_Player->OpenWindow( Window );
@@ -654,10 +663,11 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) case E_BLOCK_FURNACE:
case E_BLOCK_CHEST:
{
- LOG("Chest");
+ ////////////// For testing V
cPacket_NewInvalidState RainPacket;
RainPacket.m_Reason = 2; //end rain
Send( RainPacket );
+ ////////////// For testing ^
bPlaceBlock = false;
cBlockEntity* BlockEntity = m_Player->GetWorld()->GetBlockEntity( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ );
if( BlockEntity )
|