Fix mob attack interval

This commit is contained in:
LogicParrot
2016-01-12 14:20:17 +02:00
parent e2a053263f
commit 21df3cb0d8
7 changed files with 28 additions and 24 deletions
+2 -5
View File
@@ -34,9 +34,7 @@ void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
bool cGhast::Attack(std::chrono::milliseconds a_Dt)
{
m_AttackInterval += (static_cast<float>(a_Dt.count()) / 1000) * m_AttackRate;
if ((m_Target != nullptr) && (m_AttackInterval > 3.0))
if ((m_Target != nullptr) && (m_AttackCoolDownTicksLeft == 0))
{
// Setting this higher gives us more wiggle room for attackrate
Vector3d Speed = GetLookVector() * 20;
@@ -53,8 +51,7 @@ bool cGhast::Attack(std::chrono::milliseconds a_Dt)
return false;
}
m_World->BroadcastSpawnEntity(*GhastBall);
m_AttackInterval = 0.0;
ResetAttackCooldown();
return true;
}
return false;