set g_teleport_maxspeed 0 "maximum speed that a player can keep when going through a teleporter (if a misc_teleporter_dest also has a cap the smallest one of these will be used), 0 = don't limit, -1 = keep no speed"
set cl_damageeffect_player 0.05 "enable weapon damage effects on players, value specifies how often to show the effect"
+set cl_damageeffect_player_limit 3 "how many damages to show on a player at once"
set cl_damageeffect_gibs 0.125 "enable weapon damage effects on gibs, value specifies how often to show the effect"
set cl_damageeffect_gibs_randomize 0.5 "probability for effects to show on gibs each tick, used so gibs don't generate particles at the same time and look ugly"
set cl_damageeffect_lifetime 0.04 "how much a damage effect lasts, multiplied by damage amount"
float autocvar_cl_lerpexcess;
string autocvar__togglezoom;
float autocvar_cl_damageeffect_player;
+float autocvar_cl_damageeffect_player_limit;
float autocvar_cl_damageeffect_gibs;
float autocvar_cl_damageeffect_gibs_randomize;
float autocvar_cl_damageeffect_lifetime;
void DamageEffect(vector hitorg, float dmg, float type, float specnum, float entnumber)
{
- float life;
+ float life, i;
string specstr, effectnum;
entity e;
if(self.model == "" || !self.model)
return;
+ // if we reached our damage count limit for this player, return
+ for(e = world; (e = find(e, classname, "damageeffect")); )
+ {
+ if(e.team == entnumber)
+ i += 1;
+ }
+ if(i >= autocvar_cl_damageeffect_player_limit)
+ return;
+
specstr = species_prefix(specnum);
life = bound(0, dmg * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max);
effectnum = substring(effectnum, 0, strlen(effectnum) - 1); // remove the _ symbol at the end of the species name
}
- // if the player already has a damage effect, update it instead of spawning a new one
- entity head;
- for(head = world; (head = find(head, classname, "damageeffect")); )
- {
- if(head.team == entnumber)
- {
- head.dmgpartnum = particleeffectnum(effectnum);
- head.lifetime += life;
- return;
- }
- }
-
- float i, closest;
+ float closest;
for(i = 1; gettaginfo(self, i); i++)
{
// go through all tags on the player model, choose the one closest to the damage origin