summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorItemFollower.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/BehaviorItemFollower.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/BehaviorItemFollower.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorItemFollower.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/Mobs/Behaviors/BehaviorItemFollower.cpp b/src/Mobs/Behaviors/BehaviorItemFollower.cpp
index 833050e69..2b0377c46 100644
--- a/src/Mobs/Behaviors/BehaviorItemFollower.cpp
+++ b/src/Mobs/Behaviors/BehaviorItemFollower.cpp
@@ -7,33 +7,33 @@
cBehaviorItemFollower::cBehaviorItemFollower(cMonster * a_Parent) :
- m_Parent(a_Parent)
+ m_Parent(a_Parent)
{
- m_Parent = a_Parent;
- ASSERT(m_Parent != nullptr);
+ m_Parent = a_Parent;
+ ASSERT(m_Parent != nullptr);
}
-bool cBehaviorItemFollower::ActiveTick()
+bool cBehaviorItemFollower::Tick()
{
- cItems FollowedItems;
- m_Parent->GetFollowedItems(FollowedItems);
- if (FollowedItems.Size() > 0)
- {
- cPlayer * a_Closest_Player = m_Parent->GetNearestPlayer();
- if (a_Closest_Player != nullptr)
- {
- cItem EquippedItem = a_Closest_Player->GetEquippedItem();
- if (FollowedItems.ContainsType(EquippedItem))
- {
- Vector3d PlayerPos = a_Closest_Player->GetPosition();
- m_Parent->MoveToPosition(PlayerPos);
- return true; // We took control of the monster, prevent other Behaviors from doing so
- }
- }
- }
- return false;
+ cItems FollowedItems;
+ m_Parent->GetFollowedItems(FollowedItems);
+ if (FollowedItems.Size() > 0)
+ {
+ cPlayer * a_Closest_Player = m_Parent->GetNearestPlayer();
+ if (a_Closest_Player != nullptr)
+ {
+ cItem EquippedItem = a_Closest_Player->GetEquippedItem();
+ if (FollowedItems.ContainsType(EquippedItem))
+ {
+ Vector3d PlayerPos = a_Closest_Player->GetPosition();
+ m_Parent->MoveToPosition(PlayerPos);
+ return true; // We took control of the monster, prevent other Behaviors from doing so
+ }
+ }
+ }
+ return false;
}