Fixed AI not being alerted. Fixes bug where NPCs did not cower when the player shot near them.

This commit is contained in:
Klaus Silveira 2025-02-09 23:44:23 -05:00
parent 15be4c61ff
commit fe69f28404

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();
}