From a215070cf22472299a848111692dc1a864106a4f Mon Sep 17 00:00:00 2001 From: tumultenrx Date: Thu, 12 Mar 2015 19:37:39 +0100 Subject: Monsters will now attack. Additional checks have been added when generating spawn. Monsters will now attack. Additional checks have been added when generating spawn. --- src/Mobs/AggressiveMonster.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Mobs/AggressiveMonster.cpp') diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index 72317d66b..526b39e39 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp @@ -85,7 +85,7 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) if (ReachedFinalDestination() && !LineOfSight.Trace(GetPosition(), AttackDirection, (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) - Attack(a_Dt / 1000); + Attack(a_Dt); } } @@ -95,8 +95,7 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) void cAggressiveMonster::Attack(std::chrono::milliseconds a_Dt) { - m_AttackInterval += a_Dt.count() * m_AttackRate; - + m_AttackInterval += (static_cast(a_Dt.count()) / 1000) * m_AttackRate; if ((m_Target == nullptr) || (m_AttackInterval < 3.0)) { return; -- cgit v1.2.3