diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-17 15:09:25 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-21 07:21:29 +0100 |
commit | d344e574de0f2ac3786f05db0167c1e71e135673 (patch) | |
tree | 62915feebc023c51a43711c46a4cc5d8d05b0005 /src/Mobs/Enderman.cpp | |
parent | Merge pull request #2884 from LogicParrot/sort (diff) | |
download | cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar.gz cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar.bz2 cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar.lz cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar.xz cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.tar.zst cuberite-d344e574de0f2ac3786f05db0167c1e71e135673.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Enderman.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index ac749e36a..4a30a0acd 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -28,32 +28,32 @@ public: { return false; } - + Vector3d Direction = m_EndermanPos - a_Player->GetPosition(); - + // Don't check players who are more then SightDistance (64) blocks away if (Direction.Length() > m_SightDistance) { return false; } - + // Don't check if the player has a pumpkin on his head if (a_Player->GetEquippedHelmet().m_ItemType == E_BLOCK_PUMPKIN) { return false; } - + Vector3d LookVector = a_Player->GetLookVector(); double dot = Direction.Dot(LookVector); - + // 0.09 rad ~ 5 degrees // If the player's crosshair is within 5 degrees of the enderman, it counts as looking if (dot <= cos(0.09)) { return false; } - + cTracer LineOfSight(a_Player->GetWorld()); if (LineOfSight.Trace(m_EndermanPos, Direction, static_cast<int>(Direction.Length()))) { @@ -64,7 +64,7 @@ public: m_Player = a_Player; return true; } - + cPlayer * GetPlayer(void) const { return m_Player; } protected: @@ -102,7 +102,7 @@ void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cEnderman::CheckEventSeePlayer() +void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk) { if (m_Target != nullptr) { @@ -114,7 +114,7 @@ void cEnderman::CheckEventSeePlayer() { return; } - + ASSERT(Callback.GetPlayer() != nullptr); if (!CheckLight()) @@ -126,7 +126,7 @@ void cEnderman::CheckEventSeePlayer() if (!Callback.GetPlayer()->IsGameModeCreative()) { - cMonster::EventSeePlayer(Callback.GetPlayer()); + cMonster::EventSeePlayer(Callback.GetPlayer(), a_Chunk); m_EMState = CHASING; m_bIsScreaming = true; GetWorld()->BroadcastEntityMetadata(*this); @@ -145,7 +145,7 @@ void cEnderman::CheckEventLostPlayer(void) EventLosePlayer(); } } - + |