summaryrefslogtreecommitdiffstats
path: root/source/Entities/Pickup.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-13 11:08:51 +0100
committermadmaxoft <github@xoft.cz>2013-11-13 11:08:51 +0100
commit293051eca89351181f11443e1785617ab58459c8 (patch)
tree50c637b3c2ac3f1848610623156ce96be1b91be5 /source/Entities/Pickup.cpp
parentcWindow: Fixed item dupe glitch with painting (#278) (diff)
parentBundled fixes [SEE DESC] (diff)
downloadcuberite-293051eca89351181f11443e1785617ab58459c8.tar
cuberite-293051eca89351181f11443e1785617ab58459c8.tar.gz
cuberite-293051eca89351181f11443e1785617ab58459c8.tar.bz2
cuberite-293051eca89351181f11443e1785617ab58459c8.tar.lz
cuberite-293051eca89351181f11443e1785617ab58459c8.tar.xz
cuberite-293051eca89351181f11443e1785617ab58459c8.tar.zst
cuberite-293051eca89351181f11443e1785617ab58459c8.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Pickup.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/Entities/Pickup.cpp b/source/Entities/Pickup.cpp
index bc8abd204..f8aae9703 100644
--- a/source/Entities/Pickup.cpp
+++ b/source/Entities/Pickup.cpp
@@ -31,8 +31,9 @@ cPickup::cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_It
, m_bCollected( false )
, m_bIsPlayerCreated( IsPlayerCreated )
{
- m_MaxHealth = 5;
- m_Health = 5;
+ SetGravity(-10.5f);
+ SetMaxHealth(5);
+ SetHealth(5);
SetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
}
@@ -145,6 +146,8 @@ bool cPickup::CollectedBy(cPlayer * a_Dest)
{
m_Item.m_ItemCount -= NumAdded;
m_World->BroadcastCollectPickup(*this, *a_Dest);
+ // Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;)
+ m_World->BroadcastSoundEffect("random.pop",(int)GetPosX() * 8, (int)GetPosY() * 8, (int)GetPosZ() * 8, 0.5, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
if (m_Item.m_ItemCount == 0)
{
// All of the pickup has been collected, schedule the pickup for destroying