summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-06-08 01:32:37 +0200
committerarchshift <admin@archshift.com>2014-06-17 20:39:20 +0200
commit2185c72c2ca2d66b238d7d3234c173bd820d32ac (patch)
tree134bcd0c391bac1624a9adab5e8f9d6425fb9942 /src/Entities
parentImplemented milk, added documentation to Pawn.h (diff)
downloadcuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar.gz
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar.bz2
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar.lz
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar.xz
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.tar.zst
cuberite-2185c72c2ca2d66b238d7d3234c173bd820d32ac.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/EntityEffects.h1
-rw-r--r--src/Entities/Pawn.cpp14
-rw-r--r--src/Entities/Pawn.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/Entities/EntityEffects.h b/src/Entities/EntityEffects.h
index 2bda2e104..137eb6480 100644
--- a/src/Entities/EntityEffects.h
+++ b/src/Entities/EntityEffects.h
@@ -9,6 +9,7 @@ public:
/** All types of entity effects (numbers correspond to IDs) */
enum eType
{
+ efNoEffect = 0,
efSpeed = 1,
efSlowness = 2,
efHaste = 3,
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index 4c840e6e1..5cf270006 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -52,8 +52,22 @@ void cPawn::Tick(float a_Dt, cChunk & a_Chunk)
+void cPawn::KilledBy(cEntity *a_Killer)
+{
+ ClearEntityEffects();
+}
+
+
+
+
+
void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, cEntityEffect a_Effect)
{
+ if (a_EffectType == cEntityEffect::efNoEffect)
+ {
+ return;
+ }
+
m_EntityEffects[a_EffectType] = a_Effect;
m_World->BroadcastEntityEffect(*this, a_EffectType, a_Effect.GetIntensity(), a_Effect.m_Ticks);
}
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