summaryrefslogtreecommitdiffstats
path: root/src/Mobs/PassiveMonster.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-01-29 20:05:38 +0100
committerMattes D <github@xoft.cz>2014-01-29 20:05:38 +0100
commit07fb1bca23d4c80a9fa32a35fa5b39e517d10247 (patch)
tree37ce28c7745fb7b7dab768ce8a0780ea75138503 /src/Mobs/PassiveMonster.cpp
parentAdded instructions for ZIP source downloads. (diff)
parentDid what xoft said (diff)
downloadcuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar.gz
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar.bz2
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar.lz
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar.xz
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.tar.zst
cuberite-07fb1bca23d4c80a9fa32a35fa5b39e517d10247.zip
Diffstat (limited to 'src/Mobs/PassiveMonster.cpp')
-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..904cd63cc 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().IsEqual(FollowedItem))
+ {
+ Vector3d PlayerPos = a_Closest_Player->GetPosition();
+ MoveToPosition(PlayerPos);
+ }
+ }
}