]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Always show DamageInfo, even when hitting the same player twice.
authorRudolf Polzer <divverent@xonotic.org>
Wed, 11 Dec 2013 08:48:12 +0000 (09:48 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 11 Dec 2013 08:48:12 +0000 (09:48 +0100)
Also, prevention of hitting the same player twice SHOULD be no longer
necessary (but let's keep a big warning for this anwyay for now), as
this could only really happen due to curved projectile movement.

qcsrc/server/w_common.qc

index c3b502ec97466110f5623e161819971f5cda0b68..86ae8866ce692617f0c00e88b49cc3c8ddb64462 100644 (file)
@@ -238,30 +238,29 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
                if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
                        is_weapclip = 1;
 
-               // Avoid self-damage (except after going through a warp)
-               // FIXME can this actually happen in any other case? Probably
-               // only with weird shotorigin outside the player bbox.
-               if (hit != WarpZone_trace_forent)
-               {
-                       if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
-                               Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+               if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
+                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
 
-                       if(hit && hit != last_hit)
+               if (hit && hit != WarpZone_trace_forent)  // Avoid self-damage (except after going through a warp).
+               {
+                       if (hit == last_hit)
+                               if (WarpZone_trace_forent)
+                                       dprint("NOTE: a player was hit twice in a row by the same bullet. But a warpzone was involved. Please verify that this is OK.\n"); // TODO make sure this doesn't actually happen unless when it should.
+                               else
+                                       print("^4WARNING:^7 a player was hit twice in a row by the same bullet.\n");
+                       last_hit = hit;
+
+                       yoda = 0;
+                       float g = accuracy_isgooddamage(self, hit);
+                       Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+                       // calculate hits for ballistic weapons
+                       if(g)
                        {
-                               yoda = 0;
-                               float g = accuracy_isgooddamage(self, hit);
-                               Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
-                               // calculate hits for ballistic weapons
-                               if(g)
-                               {
-                                       // do not exceed 100%
-                                       float added_damage = min(damage - total_damage, damage * solid_penetration_left);
-                                       total_damage += damage * solid_penetration_left;
-                                       accuracy_add(self, self.weapon, 0, added_damage);
-                               }
+                               // do not exceed 100%
+                               float added_damage = min(damage - total_damage, damage * solid_penetration_left);
+                               total_damage += damage * solid_penetration_left;
+                               accuracy_add(self, self.weapon, 0, added_damage);
                        }
-
-                       last_hit = hit; // don't hit the same player twice with the same bullet
                }
 
                if (is_weapclip)