From c1692a2e3be114c2807fdaaea0fa4fcd3d4bbc5d Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 6 Jun 2014 00:16:33 -0700 Subject: Added classes for splash potions and wither skulls --- src/Entities/SplashPotionEntity.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/Entities/SplashPotionEntity.h (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h new file mode 100644 index 000000000..d82a7bfcd --- /dev/null +++ b/src/Entities/SplashPotionEntity.h @@ -0,0 +1,34 @@ +// +// SplashPotionEntity.h +// + +#pragma once + +#include "ProjectileEntity.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); + +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; + +} ; // tolua_export -- cgit v1.2.3 From 58f35af6e71f11844b9c6c1d1ebd2d7390439cca Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 7 Jun 2014 21:56:01 -0700 Subject: Added splash potion functionality --- src/Entities/SplashPotionEntity.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index d82a7bfcd..b64b668a5 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -5,7 +5,8 @@ #pragma once #include "ProjectileEntity.h" - +#include "EntityEffects.h" +#include "../World.h" @@ -13,7 +14,7 @@ // tolua_begin class cSplashPotionEntity : -public cProjectileEntity + public cProjectileEntity { typedef cProjectileEntity super; @@ -23,7 +24,7 @@ public: CLASS_PROTODEF(cSplashPotionEntity); - cSplashPotionEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); + cSplashPotionEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, cEntityEffect::eType a_EntityEffectType, cEntityEffect a_EntityEffect, int a_PotionName); protected: @@ -31,4 +32,27 @@ protected: virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; + /** 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); + + cEntityEffect::eType m_EntityEffectType; + cEntityEffect m_EntityEffect; + int m_PotionName; + + class cSplashPotionCallback : + public cPlayerListCallback + { + public: + cSplashPotionCallback(const Vector3d & a_HitPos, cEntityEffect::eType &a_EntityEffectType, cEntityEffect &a_EntityEffect); + + virtual bool Item(cPlayer * a_Player) override; + + private: + const Vector3d &m_HitPos; + cEntityEffect::eType &m_EntityEffectType; + cEntityEffect &m_EntityEffect; + }; + } ; // tolua_export -- cgit v1.2.3 From 52abd90a28736ca07ad4b2df1259f3b54fd74c9d Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 8 Jun 2014 18:14:34 -0700 Subject: Applies splash potion effects to mobs as well as players --- src/Entities/SplashPotionEntity.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index b64b668a5..0f84e6387 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -7,6 +7,7 @@ #include "ProjectileEntity.h" #include "EntityEffects.h" #include "../World.h" +#include "Entity.h" @@ -42,12 +43,12 @@ protected: int m_PotionName; class cSplashPotionCallback : - public cPlayerListCallback + public cEntityCallback { public: cSplashPotionCallback(const Vector3d & a_HitPos, cEntityEffect::eType &a_EntityEffectType, cEntityEffect &a_EntityEffect); - virtual bool Item(cPlayer * a_Player) override; + virtual bool Item(cEntity *a_Entity) override; private: const Vector3d &m_HitPos; -- cgit v1.2.3 From f5529e544cf8350daf8a20bb8d997f85ee2824f7 Mon Sep 17 00:00:00 2001 From: archshift Date: Mon, 16 Jun 2014 20:22:17 -0700 Subject: EntityEffects.x -> EntityEffect.x, Object-Oriented effects Changed effect map to take a pointer of the effect as a result. --- src/Entities/SplashPotionEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 0f84e6387..548ba3a3e 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -5,7 +5,7 @@ #pragma once #include "ProjectileEntity.h" -#include "EntityEffects.h" +#include "EntityEffect.h" #include "../World.h" #include "Entity.h" -- cgit v1.2.3 From 8cbd43e0434323dcb1ccba6e1b95a3ca16d35d44 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 11 Jul 2014 18:58:11 -0700 Subject: Added splash potions to NBT serialization and retrieval --- src/Entities/SplashPotionEntity.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 548ba3a3e..ad656d8ab 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -27,6 +27,14 @@ public: cSplashPotionEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, cEntityEffect::eType a_EntityEffectType, cEntityEffect a_EntityEffect, int a_PotionName); + cEntityEffect::eType GetEntityEffectType() { return m_EntityEffectType; } + cEntityEffect GetEntityEffect() { return m_EntityEffect; } + int GetPotionName() { return m_PotionName; } + + void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; } + void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; } + void SetPotionName(int a_PotionName) { m_PotionName = a_PotionName; } + protected: // cProjectileEntity overrides: -- cgit v1.2.3 From cc452f51c8c4e1c886932d2f7965c7b3e4ab42fe Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 15 Jul 2014 22:41:42 +0200 Subject: Restructured cSplashPotionEntity code. The callback doesn't need declaration in the header. Renamed PotionName to PotionParticleType. --- src/Entities/SplashPotionEntity.h | 46 ++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index ad656d8ab..076e477da 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -25,43 +25,35 @@ public: CLASS_PROTODEF(cSplashPotionEntity); - cSplashPotionEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, cEntityEffect::eType a_EntityEffectType, cEntityEffect a_EntityEffect, int a_PotionName); - - cEntityEffect::eType GetEntityEffectType() { return m_EntityEffectType; } - cEntityEffect GetEntityEffect() { return m_EntityEffect; } - int GetPotionName() { return m_PotionName; } + cSplashPotionEntity( + cEntity * a_Creator, + double a_X, double a_Y, double a_Z, + const Vector3d & a_Speed, + cEntityEffect::eType a_EntityEffectType, + cEntityEffect a_EntityEffect, + int a_PotionParticleType + ); + + cEntityEffect::eType GetEntityEffectType (void) const { return m_EntityEffectType; } + cEntityEffect GetEntityEffect (void) const { return m_EntityEffect; } + int GetPotionParticleType(void) const { return m_PotionParticleType; } void SetEntityEffectType(cEntityEffect::eType a_EntityEffectType) { m_EntityEffectType = a_EntityEffectType; } void SetEntityEffect(cEntityEffect a_EntityEffect) { m_EntityEffect = a_EntityEffect; } - void SetPotionName(int a_PotionName) { m_PotionName = a_PotionName; } + void SetPotionParticleType(int a_PotionParticleType) { m_PotionParticleType = a_PotionParticleType; } protected: + cEntityEffect::eType m_EntityEffectType; + cEntityEffect m_EntityEffect; + int m_PotionParticleType; + + // cProjectileEntity overrides: virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) override; virtual void OnHitEntity (cEntity & a_EntityHit, const Vector3d & a_HitPos) override; /** Splashes the potion, fires its particle effects and sounds - * @param a_HitPos The position where the potion will splash - */ + @param a_HitPos The position where the potion will splash */ void Splash(const Vector3d & a_HitPos); - - cEntityEffect::eType m_EntityEffectType; - cEntityEffect m_EntityEffect; - int m_PotionName; - - class cSplashPotionCallback : - public cEntityCallback - { - public: - cSplashPotionCallback(const Vector3d & a_HitPos, cEntityEffect::eType &a_EntityEffectType, cEntityEffect &a_EntityEffect); - - virtual bool Item(cEntity *a_Entity) override; - - private: - const Vector3d &m_HitPos; - cEntityEffect::eType &m_EntityEffectType; - cEntityEffect &m_EntityEffect; - }; - } ; // tolua_export -- cgit v1.2.3 From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Entities/SplashPotionEntity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/SplashPotionEntity.h') diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 076e477da..2c78b55d2 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -56,4 +56,4 @@ protected: /** 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); -} ; // tolua_export +} ; // tolua_export -- cgit v1.2.3