2014-04-26 20:19:45 -04:00
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2014-04-27 20:03:06 -04:00
|
|
|
#include "ExpBottleEntity.h"
|
2014-04-26 20:19:45 -04:00
|
|
|
#include "../World.h"
|
2015-11-23 18:39:19 -05:00
|
|
|
#include "../EffectID.h"
|
2014-04-26 20:19:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04:00
|
|
|
cExpBottleEntity::cExpBottleEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed) :
|
2020-04-13 12:38:06 -04:00
|
|
|
Super(pkExpBottle, a_Creator, a_Pos, 0.25, 0.25)
|
2017-09-07 04:25:34 -04:00
|
|
|
{
|
|
|
|
SetSpeed(a_Speed);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cExpBottleEntity::OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace)
|
2014-09-23 03:12:28 -04:00
|
|
|
{
|
|
|
|
Break(a_HitPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04:00
|
|
|
void cExpBottleEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
|
2014-09-23 03:12:28 -04:00
|
|
|
{
|
|
|
|
Break(a_HitPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04:00
|
|
|
void cExpBottleEntity::Break(Vector3d a_HitPos)
|
2014-04-26 20:19:45 -04:00
|
|
|
{
|
|
|
|
// Spawn an experience orb with a reward between 3 and 11.
|
2018-07-26 19:12:41 -04:00
|
|
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, GetPosition().Floor(), 0);
|
2017-06-13 15:35:30 -04:00
|
|
|
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), GetRandomProvider().RandInt(3, 11));
|
2014-04-26 20:19:45 -04:00
|
|
|
Destroy();
|
2014-04-27 12:42:31 -04:00
|
|
|
}
|