summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorAggressive.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-23 18:08:48 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-23 18:08:48 +0200
commit978663b725dd2a7b756b4fcecf0453e42ce16b79 (patch)
tree9d8bdac1a21de5f8bbb9b2142832516d2c04f816 /src/Mobs/Behaviors/BehaviorAggressive.cpp
parentd (diff)
downloadcuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar.gz
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar.bz2
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar.lz
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar.xz
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.tar.zst
cuberite-978663b725dd2a7b756b4fcecf0453e42ce16b79.zip
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAggressive.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorAggressive.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAggressive.cpp b/src/Mobs/Behaviors/BehaviorAggressive.cpp
index 2113cb1e6..b2c7cc9ef 100644
--- a/src/Mobs/Behaviors/BehaviorAggressive.cpp
+++ b/src/Mobs/Behaviors/BehaviorAggressive.cpp
@@ -10,23 +10,22 @@
cBehaviorAggressive::cBehaviorAggressive(cMonster * a_Parent) : m_Parent(a_Parent)
{
- ASSERT(m_Parent != nullptr);
- m_ParentChaser = m_Parent->GetBehaviorChaser();
- ASSERT(m_ParentChaser != nullptr);
+ ASSERT(m_Parent != nullptr);
+ m_ParentChaser = m_Parent->GetBehaviorChaser();
+ ASSERT(m_ParentChaser != nullptr);
}
-bool cBehaviorAggressive::ActiveTick()
+void cBehaviorAggressive::PreTick()
{
- // Target something new if we have no target
- if (m_ParentChaser->GetTarget() == nullptr)
- {
- m_ParentChaser->SetTarget(FindNewTarget());
- }
- return false;
+ // Target something new if we have no target
+ if (m_ParentChaser->GetTarget() == nullptr)
+ {
+ m_ParentChaser->SetTarget(FindNewTarget());
+ }
}
@@ -35,7 +34,7 @@ bool cBehaviorAggressive::ActiveTick()
void cBehaviorAggressive::Destroyed()
{
- m_Target = nullptr;
+ m_ParentChaser->SetTarget(nullptr);
}
@@ -44,6 +43,6 @@ void cBehaviorAggressive::Destroyed()
cPawn * cBehaviorAggressive::FindNewTarget()
{
- cPlayer * Closest = m_Parent->GetNearestPlayer();
- return Closest; // May be null
+ cPlayer * Closest = m_Parent->GetNearestPlayer();
+ return Closest; // May be null
}