]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_player.qc
Merge branch 'master' into mirceakitsune/damage_effects
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_player.qc
index 9570f6ab5dce132926ece193a6124a727127a2a4..235fa72cd0b8da94d4d84291d234d15a110c4b09 100644 (file)
@@ -146,6 +146,9 @@ void CopyBody(float keepvelocity)
 
        Drag_MoveDrag(oldself, self);
 
+       Violence_DamageEffect_Copy(oldself, self);
+
+       self.owner = oldself;
        self = oldself;
 }
 
@@ -188,6 +191,7 @@ void player_setupanimsformodel()
        self.anim_forwardleft = '20 1 1';
        self.anim_backright = '21 1 1';
        self.anim_backleft  = '22 1 1';
+       self.anim_melee = '23 1 1';
        animparseerror = FALSE;
        animfilename = strcat(self.model, ".animinfo");
        animfile = fopen(animfilename, FILE_READ);
@@ -214,6 +218,7 @@ void player_setupanimsformodel()
                self.anim_forwardleft  = animparseline(animfile);
                self.anim_backright    = animparseline(animfile);
                self.anim_backleft     = animparseline(animfile);
+               self.anim_melee        = animparseline(animfile);
                fclose(animfile);
 
                // derived anims
@@ -358,7 +363,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
        self.dmg_inflictor = inflictor;
 
-       if (self.health <= -150 && self.modelindex != 0)
+       if (self.health <= -autocvar_sv_gibhealth && self.modelindex != 0)
        {
                // don't use any animations as a gib
                self.frame = 0;
@@ -369,6 +374,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
                Violence_GibSplash(self, 1, 1, attacker);
                self.modelindex = 0; // restore later
                self.solid = SOLID_NOT; // restore later
+               self.takedamage = DAMAGE_NO; // restore later
        }
 }
 
@@ -537,23 +543,28 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        else
                self.pushltime = 0;
 
-       float abot, vbot;
+       float abot, vbot, awep;
        abot = (clienttype(attacker) == CLIENTTYPE_BOT);
        vbot = (clienttype(self) == CLIENTTYPE_BOT);
 
        valid_damage_for_weaponstats = 0;
        if(vbot || clienttype(self) == CLIENTTYPE_REAL)
        if(abot || clienttype(attacker) == CLIENTTYPE_REAL)
-       if(self != attacker)
-       if(!DEATH_ISSPECIAL(deathtype))
+       if(attacker && self != attacker)
        if(IsDifferentTeam(self, attacker))
+       {
+               if(DEATH_ISSPECIAL(deathtype))
+                       awep = attacker.weapon;
+               else
+                       awep = DEATH_WEAPONOF(deathtype);
                valid_damage_for_weaponstats = 1;
+       }
        
        if(valid_damage_for_weaponstats)
        {
                dh = dh - max(self.health, 0);
                da = da - max(self.armorvalue, 0);
-               WeaponStats_LogDamage(DEATH_WEAPONOF(deathtype), abot, self.weapon, vbot, dh + da);
+               WeaponStats_LogDamage(awep, abot, self.weapon, vbot, dh + da);
        }
 
        if (self.health < 1)
@@ -568,7 +579,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                }
 
                if(valid_damage_for_weaponstats)
-                       WeaponStats_LogKill(DEATH_WEAPONOF(deathtype), abot, self.weapon, vbot);
+                       WeaponStats_LogKill(awep, abot, self.weapon, vbot);
 
                if(sv_gentle < 1) // TODO make a "gentle" version?
                if(sound_allowed(MSG_BROADCAST, attacker))
@@ -717,7 +728,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                if(sv_gentle > 0 || autocvar_ekg) {
                        // remove corpse
-                       PlayerCorpseDamage (inflictor, attacker, 100.0, deathtype, hitloc, force);
+                       PlayerCorpseDamage (inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
                }
 
                // reset fields the weapons may use just in case