From 66c211c33afa1dc99f6dc3a03119ad0b99ce50c5 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 9 Apr 2021 23:17:01 +0100 Subject: Unify multiprotocol entity animations --- src/Entities/Entity.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.cpp') 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); } -- cgit v1.2.3