summaryrefslogtreecommitdiffstats
path: root/src/Mobs/AggressiveMonster.cpp
diff options
context:
space:
mode:
authorSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 16:45:47 +0200
committerSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-28 18:19:56 +0200
commitf1540173da442878e132b0bbca1f8f60141e1cd0 (patch)
tree167748cd3f296946e245bc3809cf41153bd88c36 /src/Mobs/AggressiveMonster.cpp
parentMerge pull request #2152 from mc-server/fixes (diff)
downloadcuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.gz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.bz2
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.lz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.xz
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.tar.zst
cuberite-f1540173da442878e132b0bbca1f8f60141e1cd0.zip
Diffstat (limited to 'src/Mobs/AggressiveMonster.cpp')
-rw-r--r--src/Mobs/AggressiveMonster.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
index 648599999..93f7cdb72 100644
--- a/src/Mobs/AggressiveMonster.cpp
+++ b/src/Mobs/AggressiveMonster.cpp
@@ -80,9 +80,10 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
Vector3d AttackDirection(m_Target->GetPosition() + Vector3d(0, m_Target->GetHeight(), 0) - MyHeadPosition);
- if (ReachedFinalDestination() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())))
+ if (TargetIsInRange() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())))
{
// Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls)
+ StopMovingToPosition();
Attack(a_Dt);
}
}