]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Merge remote branch 'origin/master' into samual/mutator_ctf
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 0bd7a8da84b4ae6aa743673b45df1db5f428d958..285493b2a1bfae72edc7d9d46fa8a0034f1aeecd 100644 (file)
@@ -208,7 +208,7 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype)
                        }
                        f = 0;
                }
-               else if(g_ctf)
+               else if(g_ctf) // FIXCTF
                {
                        if(g_ctf_ignore_frags)
                                f = 0;
@@ -299,13 +299,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
        string  s, a, msg;
        float w, type;
 
-       if (targ.classname == "player" || targ.classname == "corpse")
+       if (targ.classname == "player")
        {
-               if (targ.classname == "corpse")
-                       s = "A corpse";
-               else
-                       s = targ.netname;
-
+               s = targ.netname;
                a = attacker.netname;
 
                if (targ == attacker) // suicides
@@ -333,7 +329,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                        Send_KillNotification(s, msg, ftos(w), deathtype, MSG_SUICIDE);
                }
-               else if (attacker.classname == "player" || attacker.classname == "gib")
+               else if (attacker.classname == "player")
                {
                        if(teamplay && attacker.team == targ.team)
                        {
@@ -396,7 +392,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                                if(g_ctf && targ.flagcarried)
                                {
-                                       UpdateFrags(attacker, ctf_score_value("score_kill"));
+                                       UpdateFrags(attacker, ctf_ReadScore("score_kill")); // FIXCTF
                                        PlayerScore_Add(attacker, SP_CTF_FCKILLS, 1);
                                        GiveFrags(attacker, targ, 0, deathtype); // for logging
                                }
@@ -712,15 +708,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                damage = damage * autocvar_g_balance_selfdamagepercent; // Partial damage if the attacker hits himself
                }
 
-               // CTF: reduce damage/force
-               if(g_ctf)
-               if(targ == attacker)
-               if(targ.flagcarried)
-               {
-                       damage = damage * autocvar_g_ctf_flagcarrier_selfdamage;
-                       force = force * autocvar_g_ctf_flagcarrier_selfforce;
-               }
-
                if(g_runematch)
                {
                        // apply strength rune
@@ -782,15 +769,21 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        if(deathtype & HITTYPE_HEADSHOT)
                                damage *= 1 + damage_headshotbonus;
 
-                       if(targ.classname == "player")
+                       entity victim;
+                       if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner)
+                               victim = targ.owner;
+                       else
+                               victim = targ;
+
+                       if(victim.classname == "player" || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
                        {
-                               if(IsDifferentTeam(targ, attacker))
+                               if(IsDifferentTeam(victim, attacker))
                                {
                                        if(damage > 0)
                                        {
                                                if(deathtype != DEATH_FIRE)
                                                {
-                                                       if(targ.BUTTON_CHAT)
+                                                       if(victim.BUTTON_CHAT)
                                                                attacker.typehitsound += 1;
                                                        else
                                                                attacker.hitsound += 1;
@@ -801,12 +794,13 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                                                if not(DEATH_ISSPECIAL(deathtype))
                                                {
+                                                       if(targ.classname == "player") // don't do this for vehicles
                                                        if(!g_minstagib)
-                                                       if(IsFlying(targ))
+                                                       if(IsFlying(victim))
                                                                yoda = 1;
 
                                                        if(g_minstagib)
-                                                       if(targ.items & IT_STRENGTH)
+                                                       if(victim.items & IT_STRENGTH)
                                                                yoda = 1;
 
                                                        if(deathtype & HITTYPE_HEADSHOT)