diff options
author | tycho <work.tycho@gmail.com> | 2015-05-28 12:05:41 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-05-28 12:05:41 +0200 |
commit | e19693e529bf26e62a54f60c167d1b4870d7d44a (patch) | |
tree | 0b2cb131fa2f009723dd0ecd739ff911a369c763 /src/Mobs | |
parent | Fix warnings in cPath (diff) | |
parent | Merge pull request #2151 from SafwatHalaby/wolf (diff) | |
download | cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar.gz cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar.bz2 cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar.lz cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar.xz cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.tar.zst cuberite-e19693e529bf26e62a54f60c167d1b4870d7d44a.zip |
Diffstat (limited to 'src/Mobs')
-rw-r--r-- | src/Mobs/Monster.cpp | 13 | ||||
-rw-r--r-- | src/Mobs/Wolf.cpp | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index e2906efa6..44a037805 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); diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index 61c28c467..7b5953523 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -20,6 +20,7 @@ cWolf::cWolf(void) : m_OwnerName(""), m_CollarColor(14) { + m_RelativeWalkSpeed = 2; } @@ -230,7 +231,7 @@ void cWolf::TickFollowPlayer() { // The player is present in the world, follow him: double Distance = (Callback.OwnerPos - GetPosition()).Length(); - if (Distance > 30) + if (Distance > 20) { Callback.OwnerPos.y = FindFirstNonAirBlockPosition(Callback.OwnerPos.x, Callback.OwnerPos.z); TeleportToCoords(Callback.OwnerPos.x, Callback.OwnerPos.y, Callback.OwnerPos.z); |