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 2 "enable weapon damage effects. 1 enables effects on players, 2 on players and objects"
-set cl_damageeffect_ticrate 0.05 "particles spawn rate"
-set cl_damageeffect_limit 3 "how many damages to show on a player at once (objects are limited to one effect)"
+set cl_damageeffect_ticrate 0.1 "particles spawn rate"
+set cl_damageeffect_limit 5 "how many damages to allow on a player at once (objects are limited to one)"
+set cl_damageeffect_distribute 1 "divide particle intensity if multiple damages are present on a player"
set cl_damageeffect_lifetime 0.1 "how much a damage effect lasts, multiplied by damage amount"
set cl_damageeffect_lifetime_min 3 "minimum lifetime a damage effect may have"
set cl_damageeffect_lifetime_max 6 "maximum lifetime a damage effect may have"
float autocvar_cl_damageeffect;
float autocvar_cl_damageeffect_ticrate;
float autocvar_cl_damageeffect_limit;
+float autocvar_cl_damageeffect_distribute;
float autocvar_cl_damageeffect_lifetime;
float autocvar_cl_damageeffect_lifetime_min;
float autocvar_cl_damageeffect_lifetime_max;
(get_weaponinfo(i)).weapon_func(WR_PRECACHE);
}
+.float total_damages;
void DamageEffect_Think()
{
+ // if particle distribution is enabled, decrease ticrate by total number of damages
+ if(autocvar_cl_damageeffect_distribute)
+ self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+ else
+ self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+
if(time >= self.cnt || self.owner == world || self.owner.model == "" || !self.owner.drawmask)
{
// time is up or the player got gibbed / disconnected
+ self.owner.total_damages -= 1;
remove(self);
return;
}
- self.nextthink = time + autocvar_cl_damageeffect_ticrate;
if(self.owner.entnum == player_localentnum && !autocvar_chase_active)
return; // if we aren't using a third person view, hide our own effects
{
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
- float life, i;
+ float life;
string specstr, effectnum;
entity e;
return;
// return if we reached our damage effect limit
- for(e = world; (e = find(e, classname, "damageeffect")); )
- if(e.owner.entnum == self.entnum)
- i += 1;
if(self.isplayermodel)
{
- if(autocvar_cl_damageeffect < 1 || i >= autocvar_cl_damageeffect_limit)
+ if(autocvar_cl_damageeffect < 1 || self.total_damages >= autocvar_cl_damageeffect_limit)
return; // allow multiple damage effects on players
}
else
{
- if(autocvar_cl_damageeffect < 2 || i)
+ if(autocvar_cl_damageeffect < 2 || self.total_damages)
return; // allow a single damage effect on objects
}
e.team = particleeffectnum(effectnum);
e.think = DamageEffect_Think;
e.nextthink = time;
+ self.total_damages += 1;
}