From: Martin Taibr Date: Mon, 28 Aug 2017 01:38:33 +0000 (+0200) Subject: blaster self push scaling X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=908b100f4845308e5630af89f8f4ac1af3961fb0;p=xonotic%2Fxonotic-data.pk3dir.git blaster self push scaling --- diff --git a/balance-mario.cfg b/balance-mario.cfg index a8f59a8cd..5b2674f0f 100644 --- a/balance-mario.cfg +++ b/balance-mario.cfg @@ -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 diff --git a/balance-nexuiz25.cfg b/balance-nexuiz25.cfg index 4967fa7e4..522c2f3f1 100644 --- a/balance-nexuiz25.cfg +++ b/balance-nexuiz25.cfg @@ -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 diff --git a/balance-overkill.cfg b/balance-overkill.cfg index 55440e078..cca038c44 100644 --- a/balance-overkill.cfg +++ b/balance-overkill.cfg @@ -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 diff --git a/balance-samual.cfg b/balance-samual.cfg index 52fd03dc7..bb197c0f6 100644 --- a/balance-samual.cfg +++ b/balance-samual.cfg @@ -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 diff --git a/balance-xdf.cfg b/balance-xdf.cfg index 4d2697206..763ab36d0 100644 --- a/balance-xdf.cfg +++ b/balance-xdf.cfg @@ -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 diff --git a/balance-xonotic.cfg b/balance-xonotic.cfg index fece8cd72..e0f5ecdef 100644 --- a/balance-xonotic.cfg +++ b/balance-xonotic.cfg @@ -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 diff --git a/balance-xpm.cfg b/balance-xpm.cfg index 984972623..2f7ee6763 100644 --- a/balance-xpm.cfg +++ b/balance-xpm.cfg @@ -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 diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 3ead71e4c..a34611cb5 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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) {