1
0

Rewritten code.

Implemented xoft suggestion.
Using MoveToPosition as tigerw suggested.
This commit is contained in:
tonibm19
2014-01-29 19:15:26 +01:00
parent ba4865f7ee
commit 1c1832b6ce
12 changed files with 25 additions and 152 deletions

View File

@@ -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);
}
}
}