]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Resolve "Setting a weapon's primary damage to 1 causes extremely overpowered push"
authorDr. Jaska <drjaska83@gmail.com>
Thu, 25 May 2023 15:12:25 +0000 (15:12 +0000)
committerterencehill <piuntn@gmail.com>
Thu, 25 May 2023 15:12:25 +0000 (15:12 +0000)
qcsrc/server/damage.qc

index 661f8f945bf2787d9d279755447757ef3620ece0..429d3e262568b56b77cab4cd76d86c73ea8de5d2 100644 (file)
@@ -531,11 +531,11 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
        FOREACH_CLIENT(IS_PLAYER(it),
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-           {
-               .entity weaponentity = weaponentities[slot];
-               if(it.(weaponentity).hook.aiment == targ)
-                       RemoveHook(it.(weaponentity).hook);
-           }
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       if(it.(weaponentity).hook.aiment == targ)
+                               RemoveHook(it.(weaponentity).hook);
+               }
        });
 
        // add waypoint
@@ -565,11 +565,11 @@ void Unfreeze(entity targ, bool reset_health)
        FOREACH_CLIENT(IS_PLAYER(it),
        {
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-           {
-               .entity weaponentity = weaponentities[slot];
-               if(it.(weaponentity).hook.aiment == targ)
-                       RemoveHook(it.(weaponentity).hook);
-           }
+               {
+                       .entity weaponentity = weaponentities[slot];
+                       if(it.(weaponentity).hook.aiment == targ)
+                               RemoveHook(it.(weaponentity).hook);
+               }
        });
 
        // remove the ice block
@@ -710,11 +710,11 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                if(IS_PLAYER(targ) && damage > 0 && attacker)
                {
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-                   {
-                       .entity went = weaponentities[slot];
-                       if(targ.(went).hook && targ.(went).hook.aiment == attacker)
-                               RemoveHook(targ.(went).hook);
-                   }
+                       {
+                               .entity went = weaponentities[slot];
+                               if(targ.(went).hook && targ.(went).hook.aiment == attacker)
+                                       RemoveHook(targ.(went).hook);
+                       }
                }
 
                if(STAT(FROZEN, targ) && !ITEM_DAMAGE_NEEDKILL(deathtype)
@@ -948,7 +948,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                                        center = CENTER_OR_VIEWOFS(targ);
 
                                        force = normalize(center - myblastorigin);
-                                       force = force * (finaldmg / coredamage) * forceintensity;
+                                       force = force * (finaldmg / max(coredamage, edgedamage)) * forceintensity;
                                        hitloc = nearest;
 
                                        // apply special scaling along the z axis if set
@@ -1018,14 +1018,15 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 
                                                if(autocvar_g_throughfloor_debug)
                                                        LOG_INFOF(" D=%f F=%f", finaldmg, vlen(force));
+
+                                               /*if (targ == attacker)
+                                               {
+                                                       print("hits ", ftos(hits), " / ", ftos(total));
+                                                       print(" finaldmg ", ftos(finaldmg), " force ", ftos(vlen(force)));
+                                                       print(" (", vtos(force), ") (", ftos(a), ")\n");
+                                               }*/
                                        }
 
-                                       //if (targ == attacker)
-                                       //{
-                                       //      print("hits ", ftos(hits), " / ", ftos(total));
-                                       //      print(" finaldmg ", ftos(finaldmg), " force ", vtos(force));
-                                       //      print(" (", ftos(a), ")\n");
-                                       //}
                                        if(finaldmg || force)
                                        {
                                                if(targ.iscreature)
@@ -1050,14 +1051,14 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
        RadiusDamage_running = 0;
 
        if(!DEATH_ISSPECIAL(deathtype))
-               accuracy_add(attacker, DEATH_WEAPONOF(deathtype), 0, min(coredamage, stat_damagedone));
+               accuracy_add(attacker, DEATH_WEAPONOF(deathtype), 0, min(max(coredamage, edgedamage), stat_damagedone));
 
        return total_damage_to_creatures;
 }
 
 float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity)
 {
-       return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, 
+       return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad,
                                                                        cantbe, mustbe, false, forceintensity, 1, deathtype, weaponentity, directhitentity);
 }