summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-04-10 00:17:01 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2021-04-12 23:35:07 +0200
commit66c211c33afa1dc99f6dc3a03119ad0b99ce50c5 (patch)
treebabedad40cb07493b7521ac15670e35547dd5fcc /src/Entities/Entity.cpp
parentRemove unused GetClassStatic in cWorld (diff)
downloadcuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar.gz
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar.bz2
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar.lz
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar.xz
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.tar.zst
cuberite-66c211c33afa1dc99f6dc3a03119ad0b99ce50c5.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index c8a6b8ef9..7bb53bd2a 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -525,7 +525,15 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
SetSpeed(a_TDI.Knockback);
}
- m_World->BroadcastEntityStatus(*this, esGenericHurt);
+ m_World->BroadcastEntityAnimation(*this, [&a_TDI]
+ {
+ switch (a_TDI.DamageType)
+ {
+ case eDamageType::dtBurning: return EntityAnimation::PawnBurns;
+ case eDamageType::dtDrowning: return EntityAnimation::PawnDrowns;
+ default: return EntityAnimation::PawnHurts;
+ }
+ }());
m_InvulnerableTicks = 10;
@@ -797,7 +805,7 @@ void cEntity::KilledBy(TakeDamageInfo & a_TDI)
// If the victim is a player the hook is handled by the cPlayer class
if (!IsPlayer())
{
- AString emptystring = AString("");
+ AString emptystring;
cRoot::Get()->GetPluginManager()->CallHookKilled(*this, a_TDI, emptystring);
}
@@ -813,7 +821,7 @@ void cEntity::KilledBy(TakeDamageInfo & a_TDI)
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ());
}
- m_World->BroadcastEntityStatus(*this, esGenericDead);
+ m_World->BroadcastEntityAnimation(*this, EntityAnimation::PawnDies);
}