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.
This commit is contained in:
@@ -48,10 +48,7 @@ void cSpider::EventSeePlayer(cPlayer * a_Player, cChunk & a_Chunk)
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
a_Player->CanMobsTarget() &&
|
||||
!((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) > 11) || (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) > 11))
|
||||
)
|
||||
if ((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) <= 11) && (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) <= 11))
|
||||
{
|
||||
Super::EventSeePlayer(a_Player, a_Chunk);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user