1
0

change from single followable item to multiple

This commit is contained in:
Gargaj
2015-11-14 16:42:26 +01:00
parent 5d5f5c9fba
commit 853e6e6882
11 changed files with 67 additions and 12 deletions

View File

@@ -43,15 +43,17 @@ void cPassiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
CheckEventLostPlayer();
}
cItem FollowedItem = GetFollowedItem();
if (FollowedItem.IsEmpty())
cItems FollowedItems;
GetFollowedItems(FollowedItems);
if (FollowedItems.Size() <= 0)
{
return;
}
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), static_cast<float>(m_SightDistance));
if (a_Closest_Player != nullptr)
{
if (a_Closest_Player->GetEquippedItem().IsEqual(FollowedItem))
cItem EquippedItem = a_Closest_Player->GetEquippedItem();
if (FollowedItems.ContainsType(EquippedItem))
{
Vector3d PlayerPos = a_Closest_Player->GetPosition();
MoveToPosition(PlayerPos);