From 87b1bfaf2aa62bf600293d11d0b3c73cfe9f9e33 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 6 Jun 2014 00:17:49 -0700 Subject: Moved Effects.h to EntityEffects.h, added initial impl --- src/Entities/Pawn.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index e76337d86..7824a06f8 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -2,6 +2,7 @@ #pragma once #include "Entity.h" +#include "EntityEffects.h" @@ -18,9 +19,15 @@ public: CLASS_PROTODEF(cPawn); cPawn(eEntityType a_EntityType, double a_Width, double a_Height); + + virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + + void AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); + void RemoveEntityEffect(cEntityEffect::eType a_EffectType); protected: bool m_bBurnable; + std::map m_EntityEffects; } ; // tolua_export -- cgit v1.2.3 From aa7b3f33b939e6a43af713549e7b3bf28d0f5ab5 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 6 Jun 2014 19:09:33 -0700 Subject: cPawn: Remove unused m_bBurnable --- src/Entities/Pawn.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 7824a06f8..a954f4a70 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -26,7 +26,6 @@ public: void RemoveEntityEffect(cEntityEffect::eType a_EffectType); protected: - bool m_bBurnable; std::map m_EntityEffects; } ; // tolua_export -- cgit v1.2.3 From 481f05b011230cba42901df939306b803bd670b6 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 6 Jun 2014 21:48:20 -0700 Subject: Entity effects: Added handlers for entity effects Implemented hunger, instant health, damage, poison, regen Added "template" entity effect implementations --- src/Entities/Pawn.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index a954f4a70..f7d7213ff 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -27,6 +27,8 @@ public: protected: std::map m_EntityEffects; + + virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); } ; // tolua_export -- cgit v1.2.3 From e98ffccd80ae05d09b40d5edd407428515b14406 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 7 Jun 2014 00:54:03 -0700 Subject: Pawn: Enabled entity effect broadcast, added typedef Typedef'd std::map to tEffectMap --- src/Entities/Pawn.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index f7d7213ff..1a897c958 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -26,7 +26,8 @@ public: void RemoveEntityEffect(cEntityEffect::eType a_EffectType); protected: - std::map m_EntityEffects; + typedef std::map tEffectMap; + tEffectMap m_EntityEffects; virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); } ; // tolua_export -- cgit v1.2.3 From 1eb04a48ee3ec4114adc4334e6fbcc7561834025 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 7 Jun 2014 13:45:00 -0700 Subject: Implemented milk, added documentation to Pawn.h --- src/Entities/Pawn.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 1a897c958..857488901 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -22,13 +22,28 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + /** Applies an entity effect + * @param a_EffectType The entity effect to apply + * @param a_Effect The parameters of the effect + */ void AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); + + /** Removes a currently applied entity effect + * @param a_EffectType The entity effect to remove + */ void RemoveEntityEffect(cEntityEffect::eType a_EffectType); + + /** Removes all currently applied entity effects (used when drinking milk) */ + void ClearEntityEffects(); protected: typedef std::map tEffectMap; tEffectMap m_EntityEffects; + /** Applies entity effect effects + * @param a_EffectType The selected entity effect + * @param a_Effect The parameters of the selected entity effect + */ virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); } ; // tolua_export -- cgit v1.2.3 From 2185c72c2ca2d66b238d7d3234c173bd820d32ac Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 7 Jun 2014 16:32:37 -0700 Subject: Implemented drinkable potions, noeffect entity effect, Clears entity effects on death --- src/Entities/Pawn.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 857488901..47fb691f4 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -21,6 +21,7 @@ public: cPawn(eEntityType a_EntityType, double a_Width, double a_Height); virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + virtual void KilledBy(cEntity * a_Killer) override; /** Applies an entity effect * @param a_EffectType The entity effect to apply -- cgit v1.2.3 From 5b2b6e06150b6299d1e19374be092c0858b0e3a8 Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 12 Jun 2014 19:50:02 -0700 Subject: Pawn: renamed HandleEntityEffects to HandleEntityEffect Exported entity effect functions for ToLua and documented them in APIDesc.lua --- src/Entities/Pawn.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 47fb691f4..2ffdd9fbb 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -23,6 +23,7 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void KilledBy(cEntity * a_Killer) override; + // tolua_begin /** Applies an entity effect * @param a_EffectType The entity effect to apply * @param a_Effect The parameters of the effect @@ -36,6 +37,7 @@ public: /** Removes all currently applied entity effects (used when drinking milk) */ void ClearEntityEffects(); + // tolua_end protected: typedef std::map tEffectMap; @@ -45,7 +47,7 @@ protected: * @param a_EffectType The selected entity effect * @param a_Effect The parameters of the selected entity effect */ - virtual void HandleEntityEffects(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); + virtual void HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); } ; // tolua_export -- cgit v1.2.3 From e289fe4dd7372a029ba85722e3ce99991e9d1d6b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 13 Jun 2014 11:04:16 +0200 Subject: Changed the AddEntityEffect() params for easier calls. --- src/Entities/Pawn.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 2ffdd9fbb..399e02e64 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -24,19 +24,21 @@ public: virtual void KilledBy(cEntity * a_Killer) override; // tolua_begin + /** Applies an entity effect - * @param a_EffectType The entity effect to apply - * @param a_Effect The parameters of the effect - */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); + @param a_EffectType The entity effect to apply + @param a_Effect The parameters of the effect + */ + void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1); /** Removes a currently applied entity effect - * @param a_EffectType The entity effect to remove - */ + @param a_EffectType The entity effect to remove + */ void RemoveEntityEffect(cEntityEffect::eType a_EffectType); /** Removes all currently applied entity effects (used when drinking milk) */ - void ClearEntityEffects(); + void ClearEntityEffects(void); + // tolua_end protected: -- cgit v1.2.3 From 9e8361976b6b0dc4c62ef48a4744ba1f59fe4346 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 13 Jun 2014 02:41:43 -0700 Subject: Entity Effects: Clarified user, added it to AddEntityEffect Added second AddEntityEffect with a pass-by-value of the class. --- src/Entities/Pawn.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 399e02e64..3b83ec52f 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -25,11 +25,20 @@ public: // tolua_begin + /** Applies an entity effect + @param a_EffectType The entity effect to apply + @param a_EffectDurationTicks The duration of the effect + @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) + @param a_User The pawn that produced the effect (e.g. threw the potion) + @param a_DistanceModifier The scalar multiplied to the potion duration, only applies to splash potions) + */ + void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_User, double a_DistanceModifier = 1); + /** Applies an entity effect @param a_EffectType The entity effect to apply @param a_Effect The parameters of the effect */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1); + void AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); /** Removes a currently applied entity effect @param a_EffectType The entity effect to remove -- cgit v1.2.3 From fa1d85feca6beee9e07cf92f015a883a190c726a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 13 Jun 2014 12:47:01 +0200 Subject: Added the OnEntityAddEffect hook. --- src/Entities/Pawn.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 3b83ec52f..c6be6f668 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -26,6 +26,7 @@ public: // tolua_begin /** Applies an entity effect + Checks with plugins if they allow the addition. @param a_EffectType The entity effect to apply @param a_EffectDurationTicks The duration of the effect @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) @@ -35,6 +36,7 @@ public: void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_User, double a_DistanceModifier = 1); /** Applies an entity effect + Checks with plugins if they allow the addition. @param a_EffectType The entity effect to apply @param a_Effect The parameters of the effect */ -- cgit v1.2.3 From 68c30790db17b9d21b2fcda4c7edec679162c577 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 13 Jun 2014 10:59:59 -0700 Subject: Entity effects: changed User to Creator, removed pawn pass-by-value --- src/Entities/Pawn.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index c6be6f668..9f7771d79 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -30,17 +30,10 @@ public: @param a_EffectType The entity effect to apply @param a_EffectDurationTicks The duration of the effect @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) - @param a_User The pawn that produced the effect (e.g. threw the potion) + @param a_Creator The pawn that produced the effect (e.g. threw the potion) @param a_DistanceModifier The scalar multiplied to the potion duration, only applies to splash potions) */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_User, double a_DistanceModifier = 1); - - /** Applies an entity effect - Checks with plugins if they allow the addition. - @param a_EffectType The entity effect to apply - @param a_Effect The parameters of the effect - */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); + void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_Creator, double a_DistanceModifier = 1); /** Removes a currently applied entity effect @param a_EffectType The entity effect to remove -- 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/Pawn.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 9f7771d79..307e5db3d 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -2,7 +2,7 @@ #pragma once #include "Entity.h" -#include "EntityEffects.h" +#include "EntityEffect.h" @@ -46,14 +46,8 @@ public: // tolua_end protected: - typedef std::map tEffectMap; + typedef std::map tEffectMap; tEffectMap m_EntityEffects; - - /** Applies entity effect effects - * @param a_EffectType The selected entity effect - * @param a_Effect The parameters of the selected entity effect - */ - virtual void HandleEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect); } ; // tolua_export -- cgit v1.2.3 From 4e6395d6ff9f34edb4dd36dc1f8e845c56b499f4 Mon Sep 17 00:00:00 2001 From: archshift Date: Fri, 11 Jul 2014 17:27:29 -0700 Subject: For now, removed creator member from Entity Effect for pointer safety --- src/Entities/Pawn.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 307e5db3d..252ec5edb 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -30,10 +30,9 @@ public: @param a_EffectType The entity effect to apply @param a_EffectDurationTicks The duration of the effect @param a_EffectIntensity The level of the effect (0 = Potion I, 1 = Potion II, etc) - @param a_Creator The pawn that produced the effect (e.g. threw the potion) @param a_DistanceModifier The scalar multiplied to the potion duration, only applies to splash potions) */ - void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, cPawn * a_Creator, double a_DistanceModifier = 1); + void AddEntityEffect(cEntityEffect::eType a_EffectType, int a_EffectDurationTicks, short a_EffectIntensity, double a_DistanceModifier = 1); /** Removes a currently applied entity effect @param a_EffectType The entity effect to remove -- cgit v1.2.3 From 430d8b42a5b8889ff3c0bfaea84ede7e543e2b64 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 11:07:10 +0200 Subject: Updated cPawn::KilledBy signature for custom death messages. --- src/Entities/Pawn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities/Pawn.h') diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 252ec5edb..63c7cfbb6 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -21,7 +21,7 @@ public: cPawn(eEntityType a_EntityType, double a_Width, double a_Height); virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void KilledBy(cEntity * a_Killer) override; + virtual void KilledBy(TakeDamageInfo & a_TDI) override; // tolua_begin -- cgit v1.2.3