From: Mircea Kitsune Date: Thu, 25 Aug 2011 15:37:47 +0000 (+0300) Subject: Arrange the code better, and allow setting effects on players and gibs independently. X-Git-Tag: xonotic-v0.6.0~110^2^2~94 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=93ded04730657c553ebc0f7e7a833bcb16484627;p=xonotic%2Fxonotic-data.pk3dir.git Arrange the code better, and allow setting effects on players and gibs independently. --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 4bd3849e5..99fa2fb87 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -358,9 +358,8 @@ set g_telefrags_teamplay 1 "never telefrag team mates" set g_telefrags_avoid 1 "when teleporters have a random destination, avoid teleporting to locations where a telefrag would happen" 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 1 "enable weapon damage effects on players, values between 0 and 1 specify probability of the effect showing on players each tick (used to reduce the effect)" -set cl_damageeffect_gibs 0.15 "probability of the effect showing on gibs each tick (used to reduce the effect)" -set cl_damageeffect_tick 0.05 "how often the damage effect is updated (particles per second), low values might cause lag" +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_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" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 10fee1894..915de339d 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -362,5 +362,5 @@ var float autocvar_cl_eventchase_distance = 140; var float autocvar_cl_eventchase_speed = 1.3; float autocvar_cl_lerpexcess; string autocvar__togglezoom; -float autocvar_cl_damageeffect; +float autocvar_cl_damageeffect_player; float autocvar_cl_damageeffect_gibs; diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 1387a4658..5d2d50551 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -242,14 +242,15 @@ void Ent_DamageEffect_Think() { self.nextthink = time; + float foundgib; entity entcs; + entcs = entcs_receiver[self.team]; if(!entcs) return; // Scan the owner of all gibs in the world. If a gib owner is the same as the player we're applying // the effect to, it means our player is gibbed. Therefore, apply particles to the gibs instead. - float foundgib; entity head; for(head = world; (head = find(head, classname, "gib")); ) { @@ -260,12 +261,11 @@ void Ent_DamageEffect_Think() foundgib = TRUE; } } - if(foundgib) // don't show effects on the invisible dead body if gibs exist - return; - // if we aren't in third person mode, hide our own damage effect + if(foundgib || !autocvar_cl_damageeffect_player) + return; // don't show effects on the invisible dead body if gibs exist if(self.team == player_localentnum - 1 && !autocvar_chase_active) - return; + 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); @@ -283,7 +283,7 @@ void Ent_DamageEffect() specnum1 = ReadByte(); // player species entnumber = ReadByte(); // player entnum - if not(autocvar_cl_damageeffect) + if(!autocvar_cl_damageeffect_player && !autocvar_cl_damageeffect_gibs) return; if(autocvar_cl_gentle || autocvar_cl_gentle_damage) return;