Made ExpBottleEntity break on entities.

Fixes #1369
master
archshift 2014-09-23 00:12:28 -07:00
parent e3e7bc21f7
commit 5f6bac2091
2 changed files with 23 additions and 1 deletions

View File

@ -18,10 +18,27 @@ cExpBottleEntity::cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y,
void cExpBottleEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
Break(a_HitPos);
}
void cExpBottleEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
Break(a_HitPos);
}
void cExpBottleEntity::Break(const Vector3d &a_HitPos)
{
// Spawn an experience orb with a reward between 3 and 11.
m_World->BroadcastSoundParticleEffect(2002, POSX_TOINT, POSY_TOINT, POSZ_TOINT, 0);
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), 3 + m_World->GetTickRandomNumber(8));
Destroy();
}

View File

@ -29,5 +29,10 @@ protected:
// cProjectileEntity overrides:
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override;
virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override;
/** Breaks the bottle, fires its particle effects and sounds
@param a_HitPos The position where the bottle will break */
void Break(const Vector3d &a_HitPos);
}; // tolua_export