summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2014-08-26 19:59:09 +0200
committerSamuel Barney <samjbarney@gmail.com>2014-08-26 19:59:09 +0200
commitb64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98 (patch)
tree006d193d64bce89c7311d92704ea955b02cbaf6d /src/Mobs/Monster.cpp
parentDunno why, but git said this needed to be pushed. (diff)
downloadcuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar.gz
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar.bz2
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar.lz
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar.xz
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.tar.zst
cuberite-b64df2ad5f119c2d8d9abb5760c2cf8fcf57ea98.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index c272dc93a..1af44271b 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -58,10 +58,11 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_MobType(a_MobType)
, m_SoundHurt(a_SoundHurt)
, m_SoundDeath(a_SoundDeath)
+ , m_DestroyTimer(0.0f)
{
- m_AI = new cAIComponent(this);
+ m_AI = new cAIAggressiveComponent(this);
m_Attack = new cAttackComponent(this);
- m_Environment = new cEnvironmentComponent(this);
+ m_Environment = new cEnvironmentComponent(this, 16);
m_Movement = new cMovementComponent(this);
// Temporary placement till I figure out where to put it
@@ -72,6 +73,27 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
m_DropChanceBoots = 0.0f;
}
+void cMonster::Tick(float a_Dt, cChunk & a_Chunk) {
+ super::Tick(a_Dt, a_Chunk);
+
+ if (m_Health <= 0)
+ {
+ // The mob is dead, but we're still animating the "puff" they leave when they die
+ m_DestroyTimer += a_Dt / 1000;
+ if (m_DestroyTimer > 1)
+ {
+ Destroy(true);
+ }
+ return;
+ }
+
+ LOG("Monster Tick...");
+ m_AI->Tick(a_Dt, a_Chunk);
+ m_Attack->Tick(a_Dt, a_Chunk);
+ m_Environment->Tick(a_Dt, a_Chunk);
+ m_Movement->Tick(a_Dt, a_Chunk);
+}
+