1
0

Now mobs follow you when holding their breed item

This commit is contained in:
tonibm19
2014-01-29 18:08:33 +01:00
parent 04107fa85d
commit ebe0f9372f
10 changed files with 153 additions and 5 deletions

View File

@@ -71,7 +71,32 @@ void cPig::OnRightClicked(cPlayer & a_Player)
}
}
void cPig::Tick(float a_Dt, cChunk & a_Chunk)
{
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
if (a_Closest_Player != NULL)
{
if (a_Closest_Player->GetEquippedItem().m_ItemType == E_ITEM_CARROT)
{
if (!IsBegging())
{
m_IsBegging = true;
m_World->BroadcastEntityMetadata(*this);
}
Vector3d PlayerPos = a_Closest_Player->GetPosition();
PlayerPos.y++;
m_FinalDestination = PlayerPos;
}
else
{
if (IsBegging())
{
m_IsBegging = false;
m_World->BroadcastEntityMetadata(*this);
}
}
}
}