diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-16 14:47:55 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-16 14:47:55 +0100 |
commit | 1a84102b102304945ea1e2c5ecf13075946b3a4a (patch) | |
tree | 3d22613b680315a07dd27edfc52a2fde31b47dd9 /src/Mobs | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
download | cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar.gz cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar.bz2 cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar.lz cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar.xz cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.tar.zst cuberite-1a84102b102304945ea1e2c5ecf13075946b3a4a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Wolf.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index ff324d073..43949d4ce 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -124,12 +124,6 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); } - - // The wolf is sitting so don't move him at all. - if (IsSitting()) - { - m_bMovingToDestination = false; - } cPlayer * a_Closest_Player = m_World->FindClosestPlayer(GetPosition(), (float)m_SightDistance); if (a_Closest_Player != NULL) @@ -148,18 +142,15 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk) SetIsBegging(true); m_World->BroadcastEntityMetadata(*this); } + // Don't move to the player if the wolf is sitting. if (IsSitting()) { m_bMovingToDestination = false; + return; } - else - { - m_bMovingToDestination = true; - } - Vector3d PlayerPos = a_Closest_Player->GetPosition(); - PlayerPos.y++; - m_FinalDestination = PlayerPos; + + MoveToPosition(a_Closest_Player->GetPosition()); break; } default: @@ -173,7 +164,7 @@ void cWolf::Tick(float a_Dt, cChunk & a_Chunk) } } - if (IsTame()) + if (IsTame() && !IsSitting()) { TickFollowPlayer(); } @@ -196,6 +187,7 @@ void cWolf::TickFollowPlayer() public: Vector3d OwnerPos; } Callback; + if (m_World->DoWithPlayer(m_OwnerName, Callback)) { // The player is present in the world, follow him: @@ -210,15 +202,7 @@ void cWolf::TickFollowPlayer() } else { - m_FinalDestination = Callback.OwnerPos; - if (IsSitting()) - { - m_bMovingToDestination = false; - } - else - { - m_bMovingToDestination = true; - } + MoveToPosition(Callback.OwnerPos); } } } |