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
// }}}
// {{{ powerups
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
// }}}
// {{{ powerups
set g_balance_falldamage_minspeed 1000
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 15
+set g_balance_damagepush_speedfactor 0
// }}}
// {{{ powerups
set g_balance_falldamage_minspeed 800
set g_balance_falldamage_factor 0.20
set g_balance_falldamage_maxdamage 15
+set g_balance_damagepush_speedfactor 5
// }}}
// {{{ powerups
set g_balance_falldamage_minspeed 800
set g_balance_falldamage_factor 0.02 // maxspeed = minspeed + maxdamage / factor = 4550
set g_balance_falldamage_maxdamage 75
+set g_balance_damagepush_speedfactor 0
// }}}
// {{{ powerups
float autocvar_crosshair_size;
float autocvar_ekg;
float autocvar_fov;
+float autocvar_g_balance_damage_pushspeedfactor;
float autocvar_g_balance_tuba_attenuation;
float autocvar_g_balance_tuba_fadetime;
float autocvar_g_balance_tuba_volume;
if(self.damageforcescale)
if(vlen(thisforce))
{
- self.move_velocity = self.move_velocity + self.damageforcescale * thisforce;
+ self.move_velocity = self.move_velocity + self.damageforcescale * damage_explosion_calcpush(thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
self.move_flags &~= FL_ONGROUND;
}
../common/util.qh
../common/items.qh
+../common/explosion_equation.qh
../common/mapinfo.qh
../common/mapinfo.qc
../common/items.qc
../server/w_all.qc
+../common/explosion_equation.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc
--- /dev/null
+vector explosion_calcpush_nomultiplier(vector explosion_v, vector target_v)
+{
+ // solution of the equations:
+ // v' = v + alpha vp // central hit
+ // m*v' + mp*vp' = m*v + mp*vp // conservation of momentum
+ // m*v'^2 + mp*vp'^2 = m*v^2 + mp*vp^2 // conservation of energy (ELASTIC hit)
+ // -> alpha = 0 // case 1: did not hit
+ // -> alpha = 2*mp*(vp^2 - vp.v) / ((m+mp) * vp^2) // case 2: did hit
+ // // non-elastic hits are somewhere between these two
+
+ float alpha;
+ alpha = explosion_v * (explosion_v - target_v);
+
+ if(alpha <= 0)
+ // target is too fast to be hittable by this
+ return '0 0 0';
+
+ alpha /= (explosion_v * explosion_v);
+ // now alpha is a multiplier
+ // we know we can divide by this, or above alpha would be == 0
+
+ return
+ explosion_v * alpha;
+}
+
+#if 0
+vector explosion_calcpush(vector explosion_v, float explosion_m, vector target_v, float target_m, float elasticity)
+{
+ // solution of the equations:
+ // v' = v + alpha vp // central hit
+ // m*v' + mp*vp' = m*v + mp*vp // conservation of momentum
+ // m*v'^2 + mp*vp'^2 = m*v^2 + mp*vp^2 // conservation of energy (ELASTIC hit)
+ // -> alpha = 0 // case 1: did not hit
+ // -> alpha = 2*mp*(vp^2 - vp.v) / ((m+mp) * vp^2) // case 2: did hit
+ // // non-elastic hits are somewhere between these two
+
+ // this would be physically correct, but we don't do that
+ return explosion_calcpush_nomultiplier(explosion_v, target_v,
+ (1 + elasticity) * (
+ explosion_m
+ ) / (
+ target_m + explosion_m
+ )
+ );
+}
+#endif
+
+// simplified formula, tuned so that if the target has velocity 0, we get exactly the original force
+vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor)
+{
+ if(speedfactor == 0)
+ return explosion_f;
+ return explosion_calcpush_nomultiplier(explosion_f * speedfactor, target_v) * (1.0 / speedfactor);
+}
--- /dev/null
+vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor);
float autocvar_g_ctf_shield_min_negscore;
float autocvar_g_cts_finish_kill_delay;
float autocvar_g_cts_selfdamage;
+float autocvar_g_damagepush_speedfactor;
float autocvar_g_deathglow;
float autocvar_g_debug_bot_commands;
float autocvar_g_domination_default_teams;
if (vlen(force))
if (self.classname != "player" || time >= self.spawnshieldtime || g_midair)
{
- self.velocity = self.velocity + self.damageforcescale * force;
+ self.velocity = self.velocity + self.damageforcescale * damage_explosion_calcpush(force, self.velocity, autocvar_g_damagepush_speedfactor);
self.flags &~= FL_ONGROUND;
UpdateCSQCProjectile(self);
}
../common/constants.qh
../common/util.qh
../common/items.qh
+../common/explosion_equation.qh
autocvars.qh
constants.qh
cheats.qc
playerstats.qc
+../common/explosion_equation.qc
+
mutators/base.qc
mutators/gamemode_keyhunt.qc
mutators/gamemode_freezetag.qc