File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ void CMonsterEnemyMemory::update()
5555 }
5656 }
5757
58- if (monster->SoundMemory .IsRememberSound ())
58+ if (monster->SoundMemory .IsRememberSound () && g_actor
59+ && g_actor->memory ().visual ().visible_now (monster))
5960 {
6061 SoundElem sound;
6162 bool dangerous;
@@ -64,12 +65,11 @@ void CMonsterEnemyMemory::update()
6465 {
6566 if (CEntityAlive const * enemy = smart_cast<CEntityAlive const *>(sound.who ))
6667 {
67- float const xz_dist = monster->Position ().distance_to_xz (g_actor ->Position ());
68- float const y_dist = _abs (monster->Position ().y - g_actor ->Position ().y );
68+ float const xz_dist = monster->Position ().distance_to_xz (enemy ->Position ());
69+ float const y_dist = _abs (monster->Position ().y - enemy ->Position ().y );
6970
7071 if (monster->CCustomMonster ::useful (&monster->memory ().enemy (), enemy) && y_dist < 10 &&
71- xz_dist < monster->get_feel_enemy_who_made_sound_max_distance () &&
72- g_actor->memory ().visual ().visible_now (monster))
72+ xz_dist < monster->get_feel_enemy_who_made_sound_max_distance ())
7373 {
7474 add_enemy (enemy);
7575
You can’t perform that action at this time.
0 commit comments