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, double a_X, double a_Y, double a_Z, Vector3d a_Speed) :
|
2014-04-27 20:03:06 -04:00
|
|
|
super(pkExpBottle, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25)
|
2014-04-26 20:19:45 -04:00
|
|
|
{
|
|
|
|
SetSpeed(a_Speed);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04: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 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.
|
2015-11-23 18:39:19 -05:00
|
|
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, POSX_TOINT, POSY_TOINT, POSZ_TOINT, 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
|
|
|
}
|