diff options
author | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-27 17:53:46 +0200 |
---|---|---|
committer | SafwatHalaby <SafwatHalaby@users.noreply.github.com> | 2015-05-27 18:26:08 +0200 |
commit | 52fcbb5c654bd0b4a0b602f9b7bebed342030e7b (patch) | |
tree | 77379b8eb3b6c9fd9e1a03d4c66d6cd03f0481be | |
parent | Merge pull request #2143 from jammet/patch-6 (diff) | |
download | cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar.gz cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar.bz2 cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar.lz cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar.xz cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.tar.zst cuberite-52fcbb5c654bd0b4a0b602f9b7bebed342030e7b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Monster.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 1da4124ed..3fbee9a65 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -196,7 +196,15 @@ bool cMonster::TickPathFinding(cChunk & a_Chunk) { if (m_NoMoreWayPoints || (--m_GiveUpCounter == 0)) { - ResetPathFinding(); // Try to calculate a path again. + if (m_EMState == ATTACKING) + { + ResetPathFinding(); // Try to calculate a path again. + // This results in mobs hanging around an unreachable target (player). + } + else + { + StopMovingToPosition(); // Find a different place to go to. + } return false; } else if (!m_Path->IsLastPoint()) // Have we arrived at the next cell, as denoted by m_NextWayPointPosition? @@ -391,6 +399,7 @@ void cMonster::MoveToPosition(const Vector3d & a_Position) void cMonster::StopMovingToPosition() { m_IsFollowingPath = false; + ResetPathFinding(); } @@ -520,7 +529,7 @@ void cMonster::SetPitchAndYawFromDestination() double HeadRotation, HeadPitch; Distance.Normalize(); VectorToEuler(Distance.x, Distance.y, Distance.z, HeadRotation, HeadPitch); - if (std::abs(BodyRotation - HeadRotation) < 120) + if (std::abs(BodyRotation - HeadRotation) < 90) { SetHeadYaw(HeadRotation); SetPitch(-HeadPitch); |