diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-30 09:44:56 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-08-30 09:44:56 +0200 |
commit | 172943dcf6e621a691ed988b08fa065f09e258a4 (patch) | |
tree | c1a0f68c6ca4ef1b2561045d84bad2646d6112c6 /src/Mobs/Behaviors/BehaviorAttacker.cpp | |
parent | d (diff) | |
download | cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.gz cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.bz2 cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.lz cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.xz cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.tar.zst cuberite-172943dcf6e621a691ed988b08fa065f09e258a4.zip |
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAttacker.cpp')
-rw-r--r-- | src/Mobs/Behaviors/BehaviorAttacker.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAttacker.cpp b/src/Mobs/Behaviors/BehaviorAttacker.cpp index 14ce8a264..56a879e84 100644 --- a/src/Mobs/Behaviors/BehaviorAttacker.cpp +++ b/src/Mobs/Behaviors/BehaviorAttacker.cpp @@ -6,7 +6,7 @@ #include "../Monster.h" #include "../../Entities/Pawn.h" #include "../../Entities/Player.h" - +#include "../../Tracer.h" cBehaviorAttacker::cBehaviorAttacker() : @@ -193,23 +193,17 @@ bool cBehaviorAttacker::TargetIsInStrikeRange() { ASSERT(m_Target != nullptr); ASSERT(m_Parent != nullptr); - /* - #include "../../Tracer.h" + + cTracer LineOfSight(m_Parent->GetWorld()); Vector3d MyHeadPosition = m_Parent->GetPosition() + Vector3d(0, m_Parent->GetHeight(), 0); - Vector3d AttackDirection(m_ParentChaser->GetTarget()->GetPosition() + Vector3d(0, GetTarget()->GetHeight(), 0) - MyHeadPosition); + Vector3d AttackDirection(GetTarget()->GetPosition() + Vector3d(0, GetTarget()->GetHeight(), 0) - MyHeadPosition); - - if (GetTarget() != nullptr) - { - MoveToPosition(GetTarget()->GetPosition()); - } if (TargetIsInRange() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<int>(AttackDirection.Length())) && (GetHealth() > 0.0)) { // Attack if reached destination, target isn't null, and have a clear line of sight to target (so won't attack through walls) Attack(a_Dt); } - */ return ((m_Target->GetPosition() - m_Parent->GetPosition()).SqrLength() < (m_AttackRange * m_AttackRange)); } |