diff options
author | archshift <admin@archshift.com> | 2014-07-29 22:04:00 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-07-29 22:04:00 +0200 |
commit | a9b597087b56b4526a3f6447789ba141568575a1 (patch) | |
tree | a08542d77b5668a25ca5e00492577ed6f4d61a9a /src/Entities/SplashPotionEntity.h | |
parent | Spacing fixes and a few more BLOCK_META constants. (diff) | |
parent | Slight cleanup after portals (diff) | |
download | cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.gz cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.bz2 cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.lz cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.xz cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.zst cuberite-a9b597087b56b4526a3f6447789ba141568575a1.zip |
Diffstat (limited to 'src/Entities/SplashPotionEntity.h')
-rw-r--r-- | src/Entities/SplashPotionEntity.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h new file mode 100644 index 000000000..4afc5f204 --- /dev/null +++ b/src/Entities/SplashPotionEntity.h @@ -0,0 +1,79 @@ +// +// SplashPotionEntity.h +// + +#pragma once + +#include "ProjectileEntity.h" +#include "EntityEffect.h" +#include "../World.h" +#include "Entity.h" + + + + +// tolua_begin + +class cSplashPotionEntity : + public cProjectileEntity +{ + typedef cProjectileEntity super; + +public: + + // tolua_end + + CLASS_PROTODEF(cSplashPotionEntity) + + cSplashPotionEntity( + cEntity * a_Creator, + double a_X, double a_Y, double a_Z, + const Vector3d & a_Speed, + const cItem & a_Item + ); + + cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; } + cEntityEffect GetEntityEffect(void) const { return m_EntityEffect; } + int GetPotionColor(void) const { return m_PotionColor; } + + void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; } + void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; } + void SetPotionColor(int a_PotionColor) { m_PotionColor = a_PotionColor; } + +protected: + + cEntityEffect::eType m_EntityEffectType; + cEntityEffect m_EntityEffect; + int m_PotionColor; + + + // cProjectileEntity overrides: + virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; + virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; + virtual void Tick (float a_Dt, cChunk & a_Chunk) override + { + if (m_DestroyTimer > 0) + { + m_DestroyTimer--; + if (m_DestroyTimer == 0) + { + Destroy(); + return; + } + } + else + { + super::Tick(a_Dt, a_Chunk); + } + } + + /** Splashes the potion, fires its particle effects and sounds + @param a_HitPos The position where the potion will splash */ + void Splash(const Vector3d & a_HitPos); + + virtual void SpawnOn(cClientHandle & a_Client) override; + +private: + /** Time in ticks to wait for the hit animation to begin before destroying */ + int m_DestroyTimer; +} ; // tolua_export |