summaryrefslogtreecommitdiffstats
path: root/source/Pickup.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-22 11:15:53 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-22 11:15:53 +0100
commitb29af701b9a0b6bfbd2acaae06e32e9742fd7e78 (patch)
tree54cf35d738196786b605ddff446fca32e8a45fa7 /source/Pickup.cpp
parentReduced most mobs' constructors to oneliners by passing parameters to superclasses (diff)
downloadcuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar.gz
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar.bz2
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar.lz
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar.xz
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.tar.zst
cuberite-b29af701b9a0b6bfbd2acaae06e32e9742fd7e78.zip
Diffstat (limited to 'source/Pickup.cpp')
-rw-r--r--source/Pickup.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/source/Pickup.cpp b/source/Pickup.cpp
index 3034e73de..f147434ab 100644
--- a/source/Pickup.cpp
+++ b/source/Pickup.cpp
@@ -67,36 +67,33 @@ void cPickup::SpawnOn(cClientHandle & a_Client)
-void cPickup::Tick(float a_Dt)
+void cPickup::Tick(float a_Dt, MTRand & a_TickRandom)
{
+ super::Tick(a_Dt, a_TickRandom);
+
m_Timer += a_Dt;
a_Dt = a_Dt / 1000.f;
- if(m_bCollected)
+ if (m_bCollected)
{
- if(m_Timer > 500.f) // 0.5 second
+ if (m_Timer > 500.f) // 0.5 second
{
Destroy();
return;
}
}
- if( m_Timer > 1000*60*5 ) // 5 minutes
+ if (m_Timer > 1000 * 60 * 5) // 5 minutes
{
Destroy();
return;
}
- if( m_Pos.y < 0 ) // Out of this world!
+ if (m_Pos.y < -8) // Out of this world and no more visible!
{
Destroy();
return;
}
- if (!m_bCollected)
- {
- HandlePhysics(a_Dt);
- }
-
if (!m_bReplicated || m_bDirtyPosition)
{
MoveToCorrectChunk();
@@ -229,7 +226,7 @@ void cPickup::HandlePhysics(float a_Dt)
-bool cPickup::CollectedBy( cPlayer* a_Dest )
+bool cPickup::CollectedBy(cPlayer * a_Dest)
{
if (m_bCollected)
{
@@ -252,7 +249,8 @@ bool cPickup::CollectedBy( cPlayer* a_Dest )
m_World->BroadcastCollectPickup(*this, *a_Dest);
m_bCollected = true;
m_Timer = 0;
- if( m_Item->m_ItemCount != 0 ) {
+ if (m_Item->m_ItemCount != 0)
+ {
cItems Pickup;
Pickup.push_back(cItem(*m_Item));
m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z);