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