Merge pull request #979 from klaussilveira/fix-ai

Fix bug where NPCs do not cower when the player shoots nearby
This commit is contained in:
Robert Beckebans 2025-02-28 19:13:34 +01:00 committed by GitHub
commit 1971da173d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4488,7 +4488,7 @@ void idGameLocal::AlertAI( idEntity* ent )
if( ent && ent->IsType( idActor::Type ) )
{
// alert them for the next frame
lastAIAlertTime = time + 1;
lastAIAlertTime = framenum + 1;
lastAIAlertEntity = static_cast<idActor*>( ent );
}
}
@ -4500,14 +4500,7 @@ idGameLocal::GetAlertEntity
*/
idActor* idGameLocal::GetAlertEntity()
{
int timeGroup = 0;
if( lastAIAlertTime && lastAIAlertEntity.GetEntity() )
{
timeGroup = lastAIAlertEntity.GetEntity()->timeGroup;
}
SetTimeState ts( timeGroup );
if( lastAIAlertTime >= time )
if( lastAIAlertTime >= framenum )
{
return lastAIAlertEntity.GetEntity();
}