summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-16 18:08:49 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-16 18:08:49 +0100
commit2350b77bb5fa2de05a619a3646662c9fc00ace28 (patch)
treeb9c16059bd65e051cfb6d8334d13136cb87ee2ed /src/Mobs
parentSlight cleanup of wolf code (diff)
downloadcuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar.gz
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar.bz2
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar.lz
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar.xz
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.tar.zst
cuberite-2350b77bb5fa2de05a619a3646662c9fc00ace28.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Wolf.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp
index 43949d4ce..2736c3dd1 100644
--- a/src/Mobs/Wolf.cpp
+++ b/src/Mobs/Wolf.cpp
@@ -143,14 +143,14 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
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.
- if (IsSitting())
+ if (!IsSitting())
{
- m_bMovingToDestination = false;
- return;
+ MoveToPosition(a_Closest_Player->GetPosition());
}
- MoveToPosition(a_Closest_Player->GetPosition());
break;
}
default:
@@ -168,6 +168,10 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk)
{
TickFollowPlayer();
}
+ else if (IsSitting())
+ {
+ m_bMovingToDestination = false;
+ }
}
@@ -194,11 +198,8 @@ void cWolf::TickFollowPlayer()
double Distance = (Callback.OwnerPos - GetPosition()).Length();
if (Distance > 30)
{
- if (!IsSitting())
- {
- Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
- TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
- }
+ Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z);
+ TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z);
}
else
{