summaryrefslogtreecommitdiffstats
path: root/source/cPickup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/cPickup.cpp')
-rw-r--r--source/cPickup.cpp25
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;