X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_common.qc;h=f51db6dd5dc48708f8c7477804fea7179b30d811;hp=86ae8866ce692617f0c00e88b49cc3c8ddb64462;hb=d91906e1bb6225cd68269812a6d2b4314e23fcdb;hpb=3fd748dcd694797c7b905c450c3ae180cedfc956 diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 86ae8866ce..f51db6dd5d 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -163,11 +163,13 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f } float fireBullet_trace_callback_eff; +entity fireBullet_last_hit; void fireBullet_trace_callback(vector start, vector hit, vector end) { if(vlen(hit - start) > 16) trailparticles(world, fireBullet_trace_callback_eff, start, hit); WarpZone_trace_forent = world; + fireBullet_last_hit = world; } void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, float tracereffects) @@ -179,7 +181,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat end = start + dir * MAX_SHOT_DISTANCE; entity pl; - entity last_hit = world; + fireBullet_last_hit = world; float solid_penetration_left = 1; float total_damage = 0; @@ -241,15 +243,9 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat 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 != WarpZone_trace_forent) // Avoid self-damage (except after going through a warp). + if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug). { - 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; - + fireBullet_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); @@ -287,7 +283,8 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat break; // move the entity along its velocity until it's out of solid, then let it resume - traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, TRUE); + // The previously hit entity is ignored here! + traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, TRUE, hit); if(trace_fraction == 1) // 1: we never got out of solid break;