]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
blaster self push scaling
authorMartin Taibr <taibr.martin@gmail.com>
Mon, 28 Aug 2017 01:38:33 +0000 (03:38 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Mon, 28 Aug 2017 01:38:33 +0000 (03:38 +0200)
balance-mario.cfg
balance-nexuiz25.cfg
balance-overkill.cfg
balance-samual.cfg
balance-xdf.cfg
balance-xonotic.cfg
balance-xpm.cfg
qcsrc/server/g_damage.qc

index a8f59a8cd75a31c5f5b23b1dc4590007dd7bf8df..5b2674f0fa14fd5ee018e23618e32e17036eb7df 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 4967fa7e47936208ca64c9e719e5e41fa373b968..522c2f3f1018f0db8f4962ce0349d69a595dca92 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 1400
 set g_balance_falldamage_factor 0.15
 set g_balance_falldamage_maxdamage 25
 set g_balance_damagepush_speedfactor 0
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 55440e078ead1b41bbb37ceae390f24a52ff94c2..cca038c440173f7c853da264d957da5dde0251d0 100644 (file)
@@ -178,10 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
-set g_balance_damagepush_scaling_speed_min 700
-set g_balance_damagepush_scaling_speed_max 1300
-set g_balance_damagepush_scaling_factor_slowest 1
-set g_balance_damagepush_scaling_factor_fastest 1
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 52fd03dc7e32dcc3223fa5508c0b7b19bd6c1b32..bb197c0f62f7a39efd4c6ea565c9d4c93c4ce43e 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 4d26972067abdcf3fd4a18f1e3db231bd19e4958..763ab36d05f832222cbee13f3b9c679b085fde3c 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index fece8cd726072f6b9f0ca81677ce05ffc00815d7..e0f5ecdefff000ab19ce8cf719bb99995e33af4d 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 984972623228b5a3c98c0bf6a035db3d9a7b83d9..2f7ee6763679621a5e6d8cdfb14c18d524196acc 100644 (file)
@@ -178,6 +178,12 @@ set g_balance_falldamage_minspeed 900
 set g_balance_falldamage_factor 0.20
 set g_balance_falldamage_maxdamage 40
 set g_balance_damagepush_speedfactor 2.5
+set g_balance_damagepush_scaling_speed_min 0 "speed at which reduction_slowest applies"
+set g_balance_damagepush_scaling_speed_max 700 "speed at which reduction_fastest applies"
+set g_balance_damagepush_scaling_reduction_slowest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_reduction_fastest 0 "blaster self-push forward force is reduced by this fraction of original force between reduction_slowest and reduction_fastest scaled linearly"
+set g_balance_damagepush_scaling_sideways 0 "fraction of reduction to apply to sideways pushing"
+set g_balance_damagepush_scaling_vertical 0 "fraction of reduction to apply to vertical pushing"
 set g_balance_contents_damagerate 0.2 // ticrate interval for applying damage with playerdamage/projectiledamage
 set g_balance_contents_drowndelay 10 // time under water before a player begins drowning
 set g_balance_contents_playerdamage_drowning 20 // damage per second for while player is drowning
index 3ead71e4c1509fc2216fc548cf0edbb92d2fb92d..a34611cb50ca783ddacc0c448f95b39f5070f93d 100644 (file)
@@ -617,11 +617,12 @@ void Unfreeze (entity targ)
        targ.iceblock = NULL;
 }
 
-// TODO balance cfgs
 float autocvar_g_balance_damagepush_scaling_speed_min;
 float autocvar_g_balance_damagepush_scaling_speed_max;
-float autocvar_g_balance_damagepush_scaling_factor_slowest;
-float autocvar_g_balance_damagepush_scaling_factor_fastest;
+float autocvar_g_balance_damagepush_scaling_reduction_slowest;
+float autocvar_g_balance_damagepush_scaling_reduction_fastest;
+float autocvar_g_balance_damagepush_scaling_sideways;
+float autocvar_g_balance_damagepush_scaling_vertical;
 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        float complainteamdamage = 0;
@@ -884,23 +885,31 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
        {
                vector farce = damage_explosion_calcpush(targ.damageforcescale * force, targ.velocity, autocvar_g_balance_damagepush_speedfactor);
 
-               /*LOG_INFOF("farce %v (%f)\n", farce, vlen(targ.velocity + farce));
-               vector velocity_end = targ.origin + targ.velocity / 10;
-               vector farce_end = velocity_end + farce / 10;
-               te_lightning1(NULL, targ.origin, velocity_end);
-               te_lightning1(NULL, velocity_end, farce_end);*/
-
-               //float horiz_speed = vlen(vec2(targ.velocity));
-               /*float factor = map_bound_ranges(horiz_speed,
-                       autocvar_g_balance_damagepush_scaling_speed_min, autocvar_g_balance_damagepush_scaling_speed_max,
-                       autocvar_g_balance_damagepush_scaling_factor_slowest, autocvar_g_balance_damagepush_scaling_factor_fastest);*/
-
-               float factor = map_bound_ranges(vlen(targ.velocity + farce),
-                       autocvar_g_balance_damagepush_scaling_speed_min, autocvar_g_balance_damagepush_scaling_speed_max,
-                       autocvar_g_balance_damagepush_scaling_factor_slowest, autocvar_g_balance_damagepush_scaling_factor_fastest);
-               farce = vec3(farce.x * factor, farce.y * factor, farce.z);
-               /*te_lightning1(NULL, targ.origin, targ.origin + farce / 10);
-               LOG_INFOF("factor %f - new farce %v (%f)\n", factor, farce, vlen(farce));*/
+               if (targ == attacker && DEATH_ISWEAPON(deathtype, WEP_BLASTER)) {
+                       if (vec2(targ.velocity) == '0 0 0') {
+                               // using vectoangles here would give weird results (v_forward would point up)
+                               makevectors(targ.angles);
+                       } else {
+                               vector horiz_vel = vec2(targ.velocity);
+                               makevectors(vectoangles(horiz_vel));
+                       }
+
+                       // split farce into 3 perpendicular vectors
+                       v_forward *= v_forward * farce;
+                       v_right *= v_right * farce;
+                       v_up *= v_up * farce;
+                       //LOG_INFOF("farce vlen %f - sizes: %f %f %f", vlen(farce), vlen(v_forward), vlen(v_right), vlen(v_up));
+
+                       float reduction = map_bound_ranges(vlen(targ.velocity),
+                               autocvar_g_balance_damagepush_scaling_speed_min, autocvar_g_balance_damagepush_scaling_speed_max,
+                               autocvar_g_balance_damagepush_scaling_reduction_slowest, autocvar_g_balance_damagepush_scaling_reduction_fastest);
+                       //LOG_INFOF("reduction %f", reduction);
+                       v_forward -= reduction * v_forward;
+                       v_right -= (reduction * autocvar_g_balance_damagepush_scaling_sideways) * v_right;
+                       v_up -= (reduction * autocvar_g_balance_damagepush_scaling_vertical) * v_up;
+                       farce = v_forward + v_right + v_up;
+                       //LOG_INFOF("farce vlen %f - sizes: %f %f %f", vlen(farce), vlen(v_forward), vlen(v_right), vlen(v_up));
+               }
 
                if(targ.move_movetype == MOVETYPE_PHYSICS)
                {