diff options
author | worktycho <work.tycho@gmail.com> | 2014-06-04 15:16:24 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-06-18 05:36:47 +0200 |
commit | 0690788cdfefbec3c74057e0b60d9f5aae935303 (patch) | |
tree | 921e7e58fe506a66a63875289e6ce195d53670ad | |
parent | Improved Enderman code (diff) | |
download | cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar.gz cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar.bz2 cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar.lz cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar.xz cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.tar.zst cuberite-0690788cdfefbec3c74057e0b60d9f5aae935303.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Enderman.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index 416b541ed..d26639a75 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -42,12 +42,14 @@ public: return false; } - Direction.Normalize(); Vector3d LookVector = a_Player->GetLookVector(); - LookVector.Normalize(); + double dot = Direction.Dot(LookVector); - if ((Direction - LookVector).SqrLength() > 0.02) + // 0.09 rad ~ 5 degrees. + // If the players crosshars are 10 degrees from the line linking the endermen + // It counts as looking. + if (dot > cos(0.09)) { return false; } @@ -140,4 +142,4 @@ void cEnderman::EventLosePlayer() super::EventLosePlayer(); m_bIsScreaming = false; GetWorld()->BroadcastEntityMetadata(*this); -}
\ No newline at end of file +} |