]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/LMS_forfeits_end_match' into 'master'
authorbones_was_here <bones_was_here@xa.org.au>
Sun, 20 Mar 2022 20:15:36 +0000 (20:15 +0000)
committerbones_was_here <bones_was_here@xa.org.au>
Sun, 20 Mar 2022 20:15:36 +0000 (20:15 +0000)
Fix forfeits do not end the match in LMS

Closes #2647

See merge request xonotic/xonotic-data.pk3dir!983

.gitlab-ci.yml
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/lib/vector.qh
qcsrc/server/damage.qc
qcsrc/server/damage.qh

index 296e493a04697977f731c32b3ae34b33619aa36a..8818e7d163aad5bfdf09d1a8f48f7202317eda51 100644 (file)
@@ -32,7 +32,7 @@ test_sv_game:
     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints\r
     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache\r
     - make\r
-    - EXPECT=5d093940aa7306533fdcf8f12579b316\r
+    - EXPECT=d4060caf37a2e60bab68d1f83bc57368\r
     - HASH=$(${ENGINE} -noconfig -nohome +timestamps 1 +exec serverbench.cfg\r
       | tee /dev/stderr\r
       | sed -e 's,^\[[^]]*\] ,,'\r
index 6b357968a7c8ac993ac234b82b622a3d55314d39..2429a301775621f979893f2eab1be96c61488a46 100644 (file)
@@ -479,7 +479,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
                        // WEAPONTODO: replace with simpler method
 
                        vector nearest_on_line = (w_shotorg + a * w_shotdir);
-                       vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+                       vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
 
                        if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
                                && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
index 13869b016ef35f03f16f8be5d5cfbb0e14ad9282..23bfdf05593ff178f4f31c35d4319d4985d6626a 100644 (file)
@@ -177,13 +177,23 @@ vector vec_epsilon(vector this, float eps)
        ERASEABLE
        vector NearestPointOnBox(entity box, vector org)
        {
-               vector m1 = box.mins + box.origin;
-               vector m2 = box.maxs + box.origin;
+               vector mi = box.mins + box.origin;
+               vector ma = box.maxs + box.origin;
 
                return vec3(
-                       bound(m1.x, org.x, m2.x),
-                       bound(m1.y, org.y, m2.y),
-                       bound(m1.z, org.z, m2.z)
+                       bound(mi.x, org.x, ma.x),
+                       bound(mi.y, org.y, ma.y),
+                       bound(mi.z, org.z, ma.z)
                );
        }
+
+ERASEABLE
+vector NearestPointOnBoundingBox(vector mi, vector ma, vector org)
+{
+       return vec3(
+               bound(mi.x, org.x, ma.x),
+               bound(mi.y, org.y, ma.y),
+               bound(mi.z, org.z, ma.z)
+       );
+}
 #endif
index 969423bfb83f8b0e55ae1e6add6f25b5bdebefcc..d0b3a288fb3011d5472d1d5df49a2d58ea217399 100644 (file)
@@ -881,6 +881,8 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                return 0;
        }
 
+       if (rad < 0) rad = 0;
+
        RadiusDamage_running = 1;
 
        tfloordmg = autocvar_g_throughfloor_damage;
@@ -912,27 +914,25 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                if (((cantbe != targ) && !mustbe) || (mustbe == targ))
                if (targ.takedamage)
                {
-                       vector nearest;
-                       vector diff;
-                       float power;
-
-                       // LordHavoc: measure distance to nearest point on target (not origin)
-                       // (this guarentees 100% damage on a touch impact)
-                       nearest = targ.WarpZone_findradius_nearest;
-                       diff = targ.WarpZone_findradius_dist;
+                       // measure distance from nearest point on target (not origin)
+                       // to nearest point on inflictor (not origin)
+                       vector nearest = targ.WarpZone_findradius_nearest;
+                       vector inflictornearest = NearestPointOnBoundingBox(
+                               inflictororigin - (inflictor.maxs - inflictor.mins) * 0.5,
+                               inflictororigin + (inflictor.maxs - inflictor.mins) * 0.5,
+                               nearest);
+                       vector diff = inflictornearest - nearest;
+
                        // round up a little on the damage to ensure full damage on impacts
                        // and turn the distance into a fraction of the radius
-                       power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
-                       //bprint(" ");
-                       //bprint(ftos(power));
-                       //if (targ == attacker)
-                       //      print(ftos(power), "\n");
-                       if (power > 0)
+                       float dist = max(0, vlen(diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS));
+                       if (dist <= rad)
                        {
-                               float finaldmg;
-                               if (power > 1)
-                                       power = 1;
-                               finaldmg = coredamage * power + edgedamage * (1 - power);
+                               float power = 1;
+                               if (rad > 0)
+                                       power -= (dist / rad);
+                               // at this point power can't be < 0 or > 1
+                               float finaldmg = coredamage * power + edgedamage * (1 - power);
                                if (finaldmg > 0)
                                {
                                        float a;
index fbdebd359c90703ae6b66d06e151155eaffcc96a..a1dadc1a28f052017abbcbddd6252a3c7ec3cc65 100644 (file)
@@ -135,7 +135,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity);
 
 .float damageforcescale;
-const float MIN_DAMAGEEXTRARADIUS = 2;
+const float MIN_DAMAGEEXTRARADIUS = 0.1;
 const float MAX_DAMAGEEXTRARADIUS = 16;
 .float damageextraradius;