diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index a904ac2da..1bf392e1a 100644 --- a/src/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp @@ -38,13 +38,23 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt, cChunk & void cAggressiveMonster::EventSeePlayer(cPlayer * a_Player, cChunk & a_Chunk) { + if (!a_Player->CanMobsTarget()) { return; } - Super::EventSeePlayer(a_Player, a_Chunk); - m_EMState = CHASING; + Vector3d MyHeadPosition1 = GetPosition() + Vector3d(0, GetHeight(), 0); + Vector3d TargetPosition1 = a_Player->GetPosition() + Vector3d(0, a_Player->GetHeight(), 0); + if (cLineBlockTracer::LineOfSightTrace(*GetWorld(), MyHeadPosition1, TargetPosition1, cLineBlockTracer::losAirWaterLava)) + { + //LOGINFO("Mob Saw Player!"); + Super::EventSeePlayer(a_Player, a_Chunk); + m_EMState = CHASING; + } else{ + return; + } + }