From d344e574de0f2ac3786f05db0167c1e71e135673 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sun, 17 Jan 2016 16:09:25 +0200 Subject: Spiders now friendly at daylight, new cChunk functions --- src/Mobs/Enderman.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Mobs/Enderman.cpp') 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(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(); } } - + -- cgit v1.2.3