]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
First step to implementing removal of spawned objects. Currently in debugging state...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 06e52238a63e2572acba0567f13981519ab6bde5..d7d2287ed6b093a23b63092caccfb496258af825 100644 (file)
@@ -267,8 +267,7 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed)
 void Send_KillNotification (string s1, string s2, string s3, float msg, float type)
 {
        WriteByte(MSG_ALL, SVC_TEMPENTITY);
-       WriteByte(MSG_ALL, TE_CSQC_NOTIFY);
-       WriteByte(MSG_ALL, CSQC_KILLNOTIFY);
+       WriteByte(MSG_ALL, TE_CSQC_KILLNOTIFY);
        WriteString(MSG_ALL, s1);
        WriteString(MSG_ALL, s2);
        WriteString(MSG_ALL, s3);
@@ -284,8 +283,7 @@ void Send_CSQC_KillCenterprint(entity e, string s1, string s2, float msg, float
                msg_entity = e;
                WRITESPECTATABLE_MSG_ONE({
                        WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_NOTIFY);
-                       WriteByte(MSG_ONE, CSQC_KILLCENTERPRINT);
+                       WriteByte(MSG_ONE, TE_CSQC_KILLCENTERPRINT);
                        WriteString(MSG_ONE, s1);
                        WriteString(MSG_ONE, s2);
                        WriteShort(MSG_ONE, msg);
@@ -331,7 +329,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                }
                else if (attacker.classname == "player")
                {
-                       if(teamplay && attacker.team == targ.team)
+                       if(!IsDifferentTeam(attacker, targ))
                        {
                                if(attacker.team == COLOR_TEAM1)
                                        type = KILL_TEAM_RED;
@@ -503,7 +501,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        if (gameover || targ.killcount == -666)
                return;
 
-       local entity oldself;
+       entity oldself;
        oldself = self;
        self = targ;
         damage_targ = targ;
@@ -545,12 +543,15 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        }
        else
        {
+               /*
+               skill based bot damage? gtfo. (tZork)
                if (targ.classname == "player")
                if (attacker.classname == "player")
                if (!targ.isbot)
                if (attacker.isbot)
                        damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
-
+        */
+        
                // nullify damage if teamplay is on
                if(deathtype != DEATH_TELEFRAG)
                if(attacker.classname == "player")
@@ -560,7 +561,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                damage = 0;
                                force = '0 0 0';
                        }
-                       else if(teamplay && attacker.team == targ.team)
+                       else if(!IsDifferentTeam(attacker, targ))
                        {
                                if(autocvar_teamplay_mode == 1)
                                        damage = 0;
@@ -757,26 +758,29 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                if(targ.takedamage == DAMAGE_AIM)
                if(targ != attacker)
                {
-                       if(targ.classname == "player")
+                       if(damage_headshotbonus > 0)
                        {
-                               // HEAD SHOT:
-                               // find height of hit on player axis
-                               // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
-                               vector headmins, headmaxs, org;
-                               org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
-                               headmins = org + GetHeadshotMins(targ);
-                               headmaxs = org + GetHeadshotMaxs(targ);
-                               if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
+                               if(targ.classname == "player")
+                               {
+                                       // HEAD SHOT:
+                                       // find height of hit on player axis
+                                       // if above view_ofs and below maxs, and also in the middle half of the bbox, it is head shot
+                                       vector headmins, headmaxs, org;
+                                       org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
+                                       headmins = org + GetHeadshotMins(targ);
+                                       headmaxs = org + GetHeadshotMaxs(targ);
+                                       if(trace_hits_box(railgun_start, railgun_end, headmins, headmaxs))
+                                       {
+                                               deathtype |= HITTYPE_HEADSHOT;
+                                       }
+                               }
+                               else if(targ.classname == "turret_head")
                                {
                                        deathtype |= HITTYPE_HEADSHOT;
                                }
+                               if(deathtype & HITTYPE_HEADSHOT)
+                                       damage *= 1 + damage_headshotbonus;
                        }
-                       else if(targ.classname == "turret_head")
-                       {
-                               deathtype |= HITTYPE_HEADSHOT;
-                       }
-                       if(deathtype & HITTYPE_HEADSHOT)
-                               damage *= 1 + damage_headshotbonus;
 
                        entity victim;
                        if((targ.vehicle_flags & VHF_ISVEHICLE) && targ.owner)
@@ -984,13 +988,13 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e
                                        finaldmg = coredamage * power + edgedamage * (1 - power);
                                        if (finaldmg > 0)
                                        {
-                                               local float a;
-                                               local float c;
-                                               local float hits;
-                                               local float total;
-                                               local float hitratio;
-                                               local vector hitloc;
-                                               local vector myblastorigin;
+                                               float a;
+                                               float c;
+                                               float hits;
+                                               float total;
+                                               float hitratio;
+                                               vector hitloc;
+                                               vector myblastorigin;
                                                myblastorigin = WarpZone_TransformOrigin(targ, blastorigin);
                                                center = targ.origin + (targ.mins + targ.maxs) * 0.5;
                                                // if it's a player, use the view origin as reference