diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-24 11:49:00 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-24 11:49:00 +0200 |
commit | f0fc0edd21b9340ce48561a5fceee29e4e055dff (patch) | |
tree | 658ec25a188e8ebe16ea43f201797601d6254d35 /source/cPickup.cpp | |
parent | Ignore some runtime folders (diff) | |
download | cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.gz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.bz2 cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.lz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.xz cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.tar.zst cuberite-f0fc0edd21b9340ce48561a5fceee29e4e055dff.zip |
Diffstat (limited to 'source/cPickup.cpp')
-rw-r--r-- | source/cPickup.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/cPickup.cpp b/source/cPickup.cpp index dd0da9372..a9545e57d 100644 --- a/source/cPickup.cpp +++ b/source/cPickup.cpp @@ -17,8 +17,6 @@ #include "cRoot.h" #include "cTracer.h" -#include "packets/cPacket_CollectItem.h" - #include "Vector3d.h" #include "Vector3f.h" @@ -244,18 +242,25 @@ void cPickup::HandlePhysics(float a_Dt) bool cPickup::CollectedBy( cPlayer* a_Dest ) { - if(m_bCollected) return false; // It's already collected! + if (m_bCollected) + { + return false; // It's already collected! + } + // 800 is to long - if(m_Timer < 500.f) return false; // Not old enough + if (m_Timer < 500.f) + { + return false; // Not old enough + } - if( cRoot::Get()->GetPluginManager()->CallHook( cPluginManager::E_PLUGIN_COLLECT_ITEM, 2, this, a_Dest ) ) return false; + if (cRoot::Get()->GetPluginManager()->CallHookCollectPickup(a_Dest, *this)) + { + return false; + } - if( a_Dest->GetInventory().AddItem( *m_Item ) ) + if (a_Dest->GetInventory().AddItem(*m_Item)) { - cPacket_CollectItem CollectItem; - CollectItem.m_CollectedID = m_UniqueID; - CollectItem.m_CollectorID = a_Dest->GetUniqueID(); - cRoot::Get()->GetServer()->Broadcast( CollectItem ); + m_World->BroadcastCollectPickup(*this, *a_Dest); m_bCollected = true; m_Timer = 0; |