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_gibs 0.0125 "enable weapon damage effects on gibs, value specifies how often to show the effect"
+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"
set cl_damageeffect_lifetime_max 5 "maximum amount of lifetime a damage effect may have at a time"
(get_weaponinfo(i)).weapon_func(WR_PRECACHE);
}
-.entity dmgeffect;
-.float partnum;
+// damage effect
+
+.entity dmgent;
+.float dmgpartnum, dmgtime;
void Ent_DamageEffect_Think()
{
float foundgib;
entity entcs;
+ if(self.dmgtime > time)
+ return;
entcs = entcs_receiver[self.team];
if(!entcs)
return;
if(head.team == self.team)
{
if(autocvar_cl_damageeffect_gibs)
- pointparticles(self.partnum, head.origin, '0 0 0', 1);
+ {
+ if(autocvar_cl_damageeffect_gibs_randomize < random())
+ pointparticles(self.dmgpartnum, head.origin, '0 0 0', 1);
+ self.dmgtime = time + autocvar_cl_damageeffect_gibs;
+ }
foundgib = TRUE;
}
}
return; // if we aren't in third person mode, hide own damage effect
// Now apply the effect to actual players
- pointparticles(self.partnum, entcs.origin, '0 0 0', 1);
+ pointparticles(self.dmgpartnum, entcs.origin, '0 0 0', 1);
+ self.dmgtime = time + autocvar_cl_damageeffect_player;
}
void Ent_DamageEffect()
// if the player already has a damage effect, replace it with the new one
entity head;
- for(head = world; (head = find(head, classname, "dmgeffect")); )
+ for(head = world; (head = find(head, classname, "dmgent")); )
{
if(head.team == entnumber - 1)
{
entity e;
e = spawn();
- e.classname = "dmgeffect";
+ e.classname = "dmgent";
e.team = entnumber - 1;
- e.partnum = particleeffectnum(effectnum);
+ e.dmgpartnum = particleeffectnum(effectnum);
e.think = Ent_DamageEffect_Think;
e.nextthink = time;
}