summaryrefslogtreecommitdiffstats
path: root/src/Mobs/PassiveMonster.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Mobs/PassiveMonster.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp
index d774d3170..903761a95 100644
--- a/src/Mobs/PassiveMonster.cpp
+++ b/src/Mobs/PassiveMonster.cpp
@@ -3,7 +3,7 @@
#include "PassiveMonster.h"
#include "../World.h"
-
+#include "../Entities/Player.h"
@@ -39,6 +39,20 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
{
CheckEventLostPlayer();
}
+ cItem FollowedItem = GetFollowedItem();
+ if (FollowedItem.IsEmpty())
+ {
+ return;
+ }
+ cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
+ if (a_Closest_Player != NULL)
+ {
+ if (a_Closest_Player->GetEquippedItem().m_ItemType == FollowedItem.m_ItemType)
+ {
+ Vector3d PlayerPos = a_Closest_Player->GetPosition();
+ MoveToPosition(PlayerPos);
+ }
+ }
}