From 4d2c810c64c38fd5530170d5c4d54956a5587fb2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 24 Oct 2013 00:30:20 +0100 Subject: Pickups now have collection delay when vomited Implements FS#394. --- source/Entities/Pickup.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/Entities/Pickup.cpp') diff --git a/source/Entities/Pickup.cpp b/source/Entities/Pickup.cpp index 075f93449..50431f52e 100644 --- a/source/Entities/Pickup.cpp +++ b/source/Entities/Pickup.cpp @@ -24,11 +24,12 @@ -cPickup::cPickup(double a_X, double a_Y, double a_Z, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */) +cPickup::cPickup(double a_X, double a_Y, double a_Z, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */) : cEntity(etPickup, a_X, a_Y, a_Z, 0.2, 0.2) , m_Timer( 0.f ) , m_Item(a_Item) , m_bCollected( false ) + , m_bIsPlayerCreated( IsPlayerCreated ) { m_MaxHealth = 5; m_Health = 5; @@ -126,8 +127,8 @@ bool cPickup::CollectedBy(cPlayer * a_Dest) return false; // It's already collected! } - // 800 is to long - if (m_Timer < 500.f) + // Two seconds if player created the pickup (vomiting), half a second if anything else + if (m_Timer < (m_bIsPlayerCreated ? 2000.f : 500.f)) { // LOG("Pickup %d cannot be collected by \"%s\", because it is not old enough.", m_UniqueID, a_Dest->GetName().c_str()); return false; // Not old enough -- cgit v1.2.3 From 625c5f86deb0649403994ae4bbcc4a4cd07853d0 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 24 Oct 2013 15:05:23 +0200 Subject: Fixed cPickup's constructor's parameter naming. --- source/Entities/Pickup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/Entities/Pickup.cpp') diff --git a/source/Entities/Pickup.cpp b/source/Entities/Pickup.cpp index 50431f52e..bc8abd204 100644 --- a/source/Entities/Pickup.cpp +++ b/source/Entities/Pickup.cpp @@ -24,8 +24,8 @@ -cPickup::cPickup(double a_X, double a_Y, double a_Z, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */) - : cEntity(etPickup, a_X, a_Y, a_Z, 0.2, 0.2) +cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */) + : cEntity(etPickup, a_PosX, a_PosY, a_PosZ, 0.2, 0.2) , m_Timer( 0.f ) , m_Item(a_Item) , m_bCollected( false ) -- cgit v1.2.3