diff options
author | tycho <work.tycho@gmail.com> | 2015-05-29 01:12:56 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-05-29 01:12:56 +0200 |
commit | 4956e8700d9a578fc65481c0fcfddf812366f08b (patch) | |
tree | 47ae313c74a228d254b08c5a146bbd2ea10e08b7 /src/Mobs/AggressiveMonster.cpp | |
parent | Fix comments (diff) | |
parent | Fixed Info.lua documentation (diff) | |
download | cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.gz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.bz2 cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.lz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.xz cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.tar.zst cuberite-4956e8700d9a578fc65481c0fcfddf812366f08b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/AggressiveMonster.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index 7eccf0265..7fde1e56b 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); } } |