summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorAggressive.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 09:44:56 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-30 09:44:56 +0200
commit172943dcf6e621a691ed988b08fa065f09e258a4 (patch)
treec1a0f68c6ca4ef1b2561045d84bad2646d6112c6 /src/Mobs/Behaviors/BehaviorAggressive.cpp
parentd (diff)
downloadcuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.gz
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.bz2
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.lz
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.xz
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.zst
cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.zip
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAggressive.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorAggressive.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAggressive.cpp b/src/Mobs/Behaviors/BehaviorAggressive.cpp
index 65618e123..ccea67eb4 100644
--- a/src/Mobs/Behaviors/BehaviorAggressive.cpp
+++ b/src/Mobs/Behaviors/BehaviorAggressive.cpp
@@ -1,7 +1,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "BehaviorAggressive.h"
-#include "BehaviorChaser.h"
+#include "BehaviorAttacker.h"
#include "../Monster.h"
#include "../../Chunk.h"
#include "../../Entities/Player.h"
@@ -17,10 +17,13 @@ void cBehaviorAggressive::PreTick(std::chrono::milliseconds a_Dt, cChunk & a_Chu
{
UNUSED(a_Dt);
UNUSED(a_Chunk);
+
// Target something new if we have no target
- if (m_ParentChaser->GetTarget() == nullptr)
+ cBehaviorAttacker * BehaviorAttacker = m_Parent->GetBehaviorAttacker();
+ if ((BehaviorAttacker != nullptr) && (BehaviorAttacker->GetTarget() == nullptr))
{
- m_ParentChaser->SetTarget(FindNewTarget());
+ // mobTodo enhance this
+ BehaviorAttacker->SetTarget(FindNewTarget());
}
}