1
0

Fixed sheep

This commit is contained in:
tonibm19 2014-01-29 18:32:46 +01:00
parent 73d9a285d5
commit ba4865f7ee

View File

@ -68,7 +68,6 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
void cSheep::Tick(float a_Dt, cChunk & a_Chunk) void cSheep::Tick(float a_Dt, cChunk & a_Chunk)
{ {
super::Tick(a_Dt, a_Chunk);
// The sheep should not move when he's eating so only handle the physics. // The sheep should not move when he's eating so only handle the physics.
if (m_TimeToStopEating > 0) if (m_TimeToStopEating > 0)
{ {
@ -96,27 +95,27 @@ void cSheep::Tick(float a_Dt, cChunk & a_Chunk)
m_TimeToStopEating = 40; m_TimeToStopEating = 40;
} }
} }
} cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance);
cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance); if (a_Closest_Player != NULL)
if (a_Closest_Player != NULL)
{
if (a_Closest_Player->GetEquippedItem().m_ItemType == E_ITEM_WHEAT)
{ {
if (!IsBegging()) if (a_Closest_Player->GetEquippedItem().m_ItemType == E_ITEM_WHEAT)
{ {
m_IsBegging = true; if (!IsBegging())
m_World->BroadcastEntityMetadata(*this); {
m_IsBegging = true;
m_World->BroadcastEntityMetadata(*this);
}
Vector3d PlayerPos = a_Closest_Player->GetPosition();
PlayerPos.y++;
m_FinalDestination = PlayerPos;
} }
Vector3d PlayerPos = a_Closest_Player->GetPosition(); else
PlayerPos.y++;
m_FinalDestination = PlayerPos;
}
else
{
if (IsBegging())
{ {
m_IsBegging = false; if (IsBegging())
m_World->BroadcastEntityMetadata(*this); {
m_IsBegging = false;
m_World->BroadcastEntityMetadata(*this);
}
} }
} }
} }