summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Monster.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-21 12:04:08 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-21 12:04:08 +0100
commit912a1e7adc650d20b0302a3dfe45816b5e541bc7 (patch)
tree65e7ffbf33d8f1335a4997fc5a727739f9dcdd34 /source/Mobs/Monster.cpp
parentExtended player inventory by direct r/o access to armor slots (diff)
downloadcuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar.gz
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar.bz2
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar.lz
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar.xz
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.tar.zst
cuberite-912a1e7adc650d20b0302a3dfe45816b5e541bc7.zip
Diffstat (limited to 'source/Mobs/Monster.cpp')
-rw-r--r--source/Mobs/Monster.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 82d69df57..88cfcd992 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -28,8 +28,8 @@
-cMonster::cMonster()
- : m_Target(0)
+cMonster::cMonster(void)
+ : m_Target(NULL)
, m_bMovingToDestination(false)
, m_DestinationTime( 0 )
, m_Gravity( -9.81f)
@@ -318,20 +318,23 @@ void cMonster::HandlePhysics(float a_Dt)
-void cMonster::TakeDamage(int a_Damage, cEntity* a_Instigator)
+void cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
{
- cPawn::TakeDamage( a_Damage, a_Instigator );
- m_Target = a_Instigator;
- AddReference( m_Target );
+ super::DoTakeDamage(a_TDI);
+ if (a_TDI.Attacker != NULL)
+ {
+ m_Target = a_TDI.Attacker;
+ AddReference(m_Target);
+ }
}
-void cMonster::KilledBy( cEntity* a_Killer )
+void cMonster::KilledBy(cPawn * a_Killer)
{
- cPawn::KilledBy( a_Killer );
+ super::KilledBy(a_Killer);
m_DestroyTimer = 0;
}
@@ -513,7 +516,7 @@ void cMonster::Attack(float a_Dt)
{
// Setting this higher gives us more wiggle room for attackrate
m_AttackInterval = 0.0;
- ((cPawn *)m_Target)->TakeDamage((int)m_AttackDamage, this);
+ ((cPawn *)m_Target)->TakeDamage(*this);
}
}