summaryrefslogtreecommitdiffstats
path: root/src/Mobs/AggressiveMonster.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-14 22:32:23 +0100
committerMattes D <github@xoft.cz>2015-03-14 22:32:23 +0100
commitebf0126dc9ecc0426102374796b4e18761bebb10 (patch)
treec81db2f80f9df119fa3099b31e9d574756f6441d /src/Mobs/AggressiveMonster.cpp
parentMerge pull request #1809 from flx5/master (diff)
parentFixed a small bug (diff)
downloadcuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar.gz
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar.bz2
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar.lz
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar.xz
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.tar.zst
cuberite-ebf0126dc9ecc0426102374796b4e18761bebb10.zip
Diffstat (limited to 'src/Mobs/AggressiveMonster.cpp')
-rw-r--r--src/Mobs/AggressiveMonster.cpp5
1 files changed, 2 insertions, 3 deletions
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<float>(a_Dt.count()) / 1000) * m_AttackRate;
if ((m_Target == nullptr) || (m_AttackInterval < 3.0))
{
return;