diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-02-01 00:31:05 +0100 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-02-01 00:31:05 +0100 |
commit | fec17409d2f566af18bad269fe2c5c372a474ecb (patch) | |
tree | 93baa2311e38fddb86a68e550955c261ac96cf3b /src/Mobs/PassiveMonster.cpp | |
parent | Changed signitures of Several BLockHandler Methods (diff) | |
parent | Contributors now match real life, and are alpha-sorted. (diff) | |
download | cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.gz cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.bz2 cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.lz cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.xz cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.tar.zst cuberite-fec17409d2f566af18bad269fe2c5c372a474ecb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/PassiveMonster.cpp | 16 |
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); + } + } } |