From 47c0b48bfd5df90cf889574c5634542d2aaa8873 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 18 Dec 2020 20:48:32 +0000 Subject: Monsters: improve targeting * Replace DoWithNearestPlayer with bounding box search (avoid iterating through all players in world). * Do line-of-sight checks from eye-to-eye. + Added LOS and LOS lost timer to target lost checks, in addition to distance. --- src/Mobs/Enderman.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/Mobs/Enderman.cpp') diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index 3b8cd77e5..302593183 100644 --- a/src/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp @@ -113,14 +113,8 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk) ASSERT(Callback.GetPlayer() != nullptr); - if (!Callback.GetPlayer()->CanMobsTarget()) - { - return; - } - - // Target the player - cMonster::EventSeePlayer(Callback.GetPlayer(), a_Chunk); - m_EMState = CHASING; + // Target the player: + cAggressiveMonster::EventSeePlayer(Callback.GetPlayer(), a_Chunk); m_bIsScreaming = true; GetWorld()->BroadcastEntityMetadata(*this); } @@ -129,16 +123,6 @@ void cEnderman::CheckEventSeePlayer(cChunk & a_Chunk) -void cEnderman::CheckEventLostPlayer(void) -{ - Super::CheckEventLostPlayer(); - EventLosePlayer(); -} - - - - - void cEnderman::EventLosePlayer() { Super::EventLosePlayer(); -- cgit v1.2.3