diff options
author | Alexander Harkness <me@bearbin.net> | 2015-05-23 08:25:51 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2015-05-23 08:25:51 +0200 |
commit | 6c8052f117d7ef52671fc50c7ebe70c073778504 (patch) | |
tree | 80e58765fd8f95ab3b3ec3d1431e6e08a5ea9b20 /src | |
parent | Merge pull request #2086 from Seadragon91/master (diff) | |
parent | Fixed creeper not exploding when 1 block higher than player (diff) | |
download | cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar.gz cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar.bz2 cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar.lz cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar.xz cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.tar.zst cuberite-6c8052f117d7ef52671fc50c7ebe70c073778504.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Mobs/AggressiveMonster.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index 055ff47d2..648599999 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp @@ -76,9 +76,11 @@ void cAggressiveMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } cTracer LineOfSight(GetWorld()); - Vector3d AttackDirection(m_Target->GetPosition() - GetPosition()); + Vector3d MyHeadPosition = GetPosition() + Vector3d(0, GetHeight(), 0); + Vector3d AttackDirection(m_Target->GetPosition() + Vector3d(0, m_Target->GetHeight(), 0) - MyHeadPosition); - if (ReachedFinalDestination() && !LineOfSight.Trace(GetPosition(), AttackDirection, (int)AttackDirection.Length())) + + if (ReachedFinalDestination() && !LineOfSight.Trace(MyHeadPosition, AttackDirection, static_cast<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); |