summaryrefslogtreecommitdiffstats
path: root/src/Mobs/PathFinder.cpp
diff options
context:
space:
mode:
authorSafwat Halaby <SafwatHalaby@users.noreply.github.com>2015-12-21 14:51:12 +0100
committerSafwat Halaby <SafwatHalaby@users.noreply.github.com>2015-12-21 19:00:25 +0100
commit8b4530740eeb663a87e5634c114905ae5be03cb7 (patch)
tree84c4284da19eeda3300853a96c72d785f4c3ab38 /src/Mobs/PathFinder.cpp
parentMerge pull request #2786 from SafwatHalaby/revert (diff)
downloadcuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar.gz
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar.bz2
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar.lz
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar.xz
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.tar.zst
cuberite-8b4530740eeb663a87e5634c114905ae5be03cb7.zip
Diffstat (limited to 'src/Mobs/PathFinder.cpp')
-rw-r--r--src/Mobs/PathFinder.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Mobs/PathFinder.cpp b/src/Mobs/PathFinder.cpp
index 28dce4dc2..bc79e2440 100644
--- a/src/Mobs/PathFinder.cpp
+++ b/src/Mobs/PathFinder.cpp
@@ -107,8 +107,12 @@ ePathFinderStatus cPathFinder::GetNextWayPoint(cChunk & a_Chunk, const Vector3d
}
}
+ Vector3d Waypoint(m_WayPoint);
+ Vector3d Source(m_Source);
+ Waypoint.y = 0;
+ Source.y = 0;
- if (m_Path->IsFirstPoint() || ((m_WayPoint - m_Source).SqrLength() < WAYPOINT_RADIUS))
+ if (m_Path->IsFirstPoint() || (((Waypoint - Source).SqrLength() < WAYPOINT_RADIUS) && (m_Source.y >= m_WayPoint.y)))
{
// if the mob has just started or if the mob reached a waypoint, give them a new waypoint.
m_WayPoint = m_Path->GetNextPoint();