diff options
author | Samuel Barney <samjbarney@gmail.com> | 2014-08-20 16:29:22 +0200 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2014-08-20 16:29:22 +0200 |
commit | 0bb59f5a12f2d06df75aa6cb6de1523cde0ea497 (patch) | |
tree | fa157e66041d26978f248c5edb8392f7e4d5c5e3 | |
parent | Revert "Added temporary function to allow me to grab the sight distance" (diff) | |
download | cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar.gz cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar.bz2 cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar.lz cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar.xz cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.tar.zst cuberite-0bb59f5a12f2d06df75aa6cb6de1523cde0ea497.zip |
-rw-r--r-- | src/Entities/Compoments/AIAgressiveComponent.h | 18 | ||||
-rw-r--r-- | src/Entities/Compoments/AIAgresssiveComponent.cpp | 31 | ||||
-rw-r--r-- | src/Entities/Compoments/AllComponents.h | 3 |
3 files changed, 0 insertions, 52 deletions
diff --git a/src/Entities/Compoments/AIAgressiveComponent.h b/src/Entities/Compoments/AIAgressiveComponent.h deleted file mode 100644 index 338d311e3..000000000 --- a/src/Entities/Compoments/AIAgressiveComponent.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "AIComponent.h" - -class cAIAgressiveComponent : public cAIComponent { -protected: - cEntity * m_Target; -public: - cAIAgressiveComponent(cMonster * a_Monster) : cAIComponent(a_Monster), m_Target(null){} - - virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void InStateChasing(float a_Dt); - - virtual void EventSeePlayer(cEntity *); - virtual void Attack(float a_Dt); - -protected: - bool IsMovingToTargetPosition(); -}
\ No newline at end of file diff --git a/src/Entities/Compoments/AIAgresssiveComponent.cpp b/src/Entities/Compoments/AIAgresssiveComponent.cpp deleted file mode 100644 index ae89ef5b9..000000000 --- a/src/Entities/Compoments/AIAgresssiveComponent.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "AIAgressiveComponent.h" - -void cAIAggressiveComponent::Attack(float a_Dt) -{ - float attack_interval = m_Self->GetAttackInterval(); - attack_interval += a_Dt * m_Self->GetAttackRate(); - - if ((m_Target != NULL) && (attack_interval > 3.0)) - { - // Setting this higher gives us more wiggle room for attackrate - attack_interval = 0.0f; - m_Target->TakeDamage(dtMobAttack, this, m_AttackDamage, 0); - } - - m_Self->SetAttackInterval(attack_interval) -} - -bool cAIAggressiveComponent::IsMovingToTargetPosition() -{ - // Difference between destination x and target x is negligible (to 10^-12 precision) - if (fabsf((float)m_Self->m_FinalDestination.x - (float)m_Target->GetPosX()) < std::numeric_limits<float>::epsilon()) - { - return false; - } - // Difference between destination z and target z is negligible (to 10^-12 precision) - else if (fabsf((float)m_Self->m_FinalDestination.z - (float)m_Target->GetPosZ()) > std::numeric_limits<float>::epsilon()) - { - return false; - } - return true; -}
\ No newline at end of file diff --git a/src/Entities/Compoments/AllComponents.h b/src/Entities/Compoments/AllComponents.h deleted file mode 100644 index 3d182cfde..000000000 --- a/src/Entities/Compoments/AllComponents.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "AIAgressiveComponent.h";
\ No newline at end of file |