summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-01-22 19:55:46 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-01-22 20:16:27 +0100
commit439b3304f4c82448b0e1585f8641503691212cac (patch)
tree706035da78a49c971f6d3bf3d812582581ce93a4 /src/Entities/Entity.cpp
parentMerge pull request #2894 from LogicParrot/spider (diff)
downloadcuberite-439b3304f4c82448b0e1585f8641503691212cac.tar
cuberite-439b3304f4c82448b0e1585f8641503691212cac.tar.gz
cuberite-439b3304f4c82448b0e1585f8641503691212cac.tar.bz2
cuberite-439b3304f4c82448b0e1585f8641503691212cac.tar.lz
cuberite-439b3304f4c82448b0e1585f8641503691212cac.tar.xz
cuberite-439b3304f4c82448b0e1585f8641503691212cac.tar.zst
cuberite-439b3304f4c82448b0e1585f8641503691212cac.zip
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 69f64eb40..aeb70b552 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -238,6 +238,47 @@ void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_R
+void cEntity::TakeDamage(eDamageType a_DamageType, UInt32 a_AttackerID, int a_RawDamage, double a_KnockbackAmount)
+{
+ class cNotifyWolves : public cEntityCallback
+ {
+ public:
+
+ cEntity * m_Entity;
+ eDamageType m_DamageType;
+ int m_RawDamage;
+ double m_KnockbackAmount;
+
+ virtual bool Item(cEntity * a_Attacker) override
+ {
+ cPawn * Attacker;
+ if (a_Attacker->IsPawn())
+ {
+ Attacker = static_cast<cPawn*>(a_Attacker);
+ }
+ else
+ {
+ Attacker = nullptr;
+ }
+
+
+ int FinalDamage = m_RawDamage - m_Entity->GetArmorCoverAgainst(Attacker, m_DamageType, m_RawDamage);
+ m_Entity->TakeDamage(m_DamageType, Attacker, m_RawDamage, FinalDamage, m_KnockbackAmount);
+ return true;
+ }
+ } Callback;
+
+ Callback.m_Entity = this;
+ Callback.m_DamageType = a_DamageType;
+ Callback.m_RawDamage = a_RawDamage;
+ Callback.m_KnockbackAmount = a_KnockbackAmount;
+ m_World->DoWithEntityByID(a_AttackerID, Callback);
+}
+
+
+
+
+
void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount)
{
TakeDamageInfo TDI;