Fixes to previous commit
This commit is contained in:
parent
1a84102b10
commit
2350b77bb5
@ -143,14 +143,14 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
m_World->BroadcastEntityMetadata(*this);
|
m_World->BroadcastEntityMetadata(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_FinalDestination = a_Closest_Player->GetPosition(); // So that we will look at a player holding food
|
||||||
|
|
||||||
// Don't move to the player if the wolf is sitting.
|
// Don't move to the player if the wolf is sitting.
|
||||||
if (IsSitting())
|
if (!IsSitting())
|
||||||
{
|
{
|
||||||
m_bMovingToDestination = false;
|
MoveToPosition(a_Closest_Player->GetPosition());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveToPosition(a_Closest_Player->GetPosition());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -168,6 +168,10 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
TickFollowPlayer();
|
TickFollowPlayer();
|
||||||
}
|
}
|
||||||
|
else if (IsSitting())
|
||||||
|
{
|
||||||
|
m_bMovingToDestination = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -193,13 +197,10 @@ void cWolf::TickFollowPlayer()
|
|||||||
// The player is present in the world, follow him:
|
// The player is present in the world, follow him:
|
||||||
double Distance = (Callback.OwnerPos - GetPosition()).Length();
|
double Distance = (Callback.OwnerPos - GetPosition()).Length();
|
||||||
if (Distance > 30)
|
if (Distance > 30)
|
||||||
{
|
|
||||||
if (!IsSitting())
|
|
||||||
{
|
{
|
||||||
Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
|
Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
|
||||||
TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
|
TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MoveToPosition(Callback.OwnerPos);
|
MoveToPosition(Callback.OwnerPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user