From: Rudolf Polzer Date: Wed, 11 Dec 2013 08:48:12 +0000 (+0100) Subject: Always show DamageInfo, even when hitting the same player twice. X-Git-Tag: xonotic-v0.8.0~190^2~4^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3fd748dcd694797c7b905c450c3ae180cedfc956;p=xonotic%2Fxonotic-data.pk3dir.git Always show DamageInfo, even when hitting the same player twice. 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. --- diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index c3b502ec9..86ae8866c 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -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)