SERVER: Add a 0.25s delay before checking if we're facing an enemy

This commit is contained in:
Steam Deck User 2023-02-08 22:49:38 -05:00
parent e63f68e897
commit f85f3e5429

View file

@ -336,6 +336,7 @@ void() PlayerPreThink =
} }
}; };
float player_trace_time;
void() PlayerPostThink = void() PlayerPostThink =
{ {
if(self.isspec) if(self.isspec)
@ -440,7 +441,9 @@ void() PlayerPostThink =
// Perform a traceline to keep track of entities directly // Perform a traceline to keep track of entities directly
// in front of the player. // in front of the player.
// Also don't do it every frame because that's really tough
// on perf.
if (player_trace_time < time) {
vector source; vector source;
makevectors (self.v_angle); makevectors (self.v_angle);
@ -473,6 +476,9 @@ void() PlayerPostThink =
else else
self.facingenemy = false; self.facingenemy = false;
// 1/4 of a second is enough of a delay to not kill the effect.
player_trace_time = time + 0.25;
}
}; };
void() ClientKill = {}; void() ClientKill = {};