]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Global forces: allow inflicted force to not apply to self 350/head
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 13 Jun 2016 08:06:37 +0000 (18:06 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 13 Jun 2016 08:11:15 +0000 (18:11 +1000)
qcsrc/common/mutators/mutator/globalforces/globalforces.qc

index 96735a005d6babb96a61ab49661fc386578911d2..49ac468ba57a0893f2a31e4c118c3c56e94b47e8 100644 (file)
@@ -1,8 +1,9 @@
 #ifdef IMPLEMENTATION
 
 AUTOCVAR(g_globalforces, float, false, "Global forces: knockback affects everyone");
-AUTOCVAR(g_globalforces_noself, bool, false, "Global forces: ignore self damage");
-AUTOCVAR(g_globalforces_range, float, 0, "Global forces: max range of effect");
+AUTOCVAR(g_globalforces_noself, bool, true, "Global forces: ignore self damage");
+AUTOCVAR(g_globalforces_self, float, 1, "Global forces: knockback self scale");
+AUTOCVAR(g_globalforces_range, float, 1000, "Global forces: max range of effect");
 REGISTER_MUTATOR(mutator_globalforces, autocvar_g_globalforces);
 
 MUTATOR_HOOKFUNCTION(mutator_globalforces, BuildMutatorsString) {
@@ -24,7 +25,8 @@ MUTATOR_HOOKFUNCTION(mutator_globalforces, PlayerDamage_SplitHealthArmor) {
                 continue;
             }
         }
-        it.velocity += damage_explosion_calcpush(it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor);
+        float f = (it == frag_attacker) ? autocvar_g_globalforces_self : 1;
+        it.velocity += damage_explosion_calcpush(f * it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor);
     });
 }