From 935c37f819852798066a0256d63876f67e7b800a Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sun, 18 Dec 2016 09:04:46 +0100 Subject: [PATCH] Fix monsters ignoring the player under certain circumstances In ai_checkattack() is a check against AI_SOUND_TARGET. If the player made a noice and the the monster noticed this noise it's true. If that noice was more than 5 seconds ago the monster forgets that event and continues with it's search for the player. Otherwise it informs the surrounding monsters that something interesting has happened and then returns false. So the problem is: Even if the monster heard the player and can see him, it aborts at this point. Fix this by adding an additional visibility check. Do the sound checking only if the player is not visible, otherwise just continue. This was reported by shoober420 and debbuged by maraakate. This fix was DanielGibons idea. This commit fixes issue #162. --- src/game/g_ai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/g_ai.c b/src/game/g_ai.c index 41b01b02..eb73bb03 100644 --- a/src/game/g_ai.c +++ b/src/game/g_ai.c @@ -950,7 +950,7 @@ ai_checkattack(edict_t *self) return false; } - if (self->monsterinfo.aiflags & AI_SOUND_TARGET) + if (!visible(self, self->goalentity) && (self->monsterinfo.aiflags & AI_SOUND_TARGET)) { if ((level.time - self->enemy->teleport_time) > 5.0) {