From 790042a2cf92ade8412b6db4c26ef9366fc024cb Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 12 Mar 2017 01:08:54 +1000 Subject: [PATCH] Fix air dodging to not go crazy high speeds, also decrease the default dodging delay (such a long delay is no longer needed now that speed is limited) --- mutators.cfg | 3 ++- .../common/mutators/mutator/dodging/sv_dodging.qc | 15 ++++++++++++--- qcsrc/common/stats.qh | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mutators.cfg b/mutators.cfg index c272b5bd6..f61930852 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -12,7 +12,7 @@ seta cl_dodging_timeout 0.2 "determines how long apart (in seconds) two taps on set sv_dodging_air_dodging 0 set sv_dodging_wall_dodging 0 "allow dodging off walls" -set sv_dodging_delay 0.7 "determines how long a player has to wait to be able to dodge again after dodging" +set sv_dodging_delay 0.5 "determines how long a player has to wait to be able to dodge again after dodging" set sv_dodging_up_speed 200 "the jump velocity of the dodge" set sv_dodging_horiz_speed 400 "the horizontal velocity of the dodge" set sv_dodging_horiz_speed_frozen 200 "the horizontal velocity of the dodge while frozen" @@ -22,6 +22,7 @@ set sv_dodging_wall_distance_threshold 10 "the maximum distance from a wall that set sv_dodging_sound 1 "if 1 dodging makes a sound. if 0 dodging is silent" set sv_dodging_frozen 0 "allow dodging while frozen" set sv_dodging_frozen_doubletap 0 +set sv_dodging_maxspeed 450 "maximum speed a player can be moving at before they dodge again" // =========== diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index fb1502dbc..05201ebcf 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -11,6 +11,7 @@ #define PHYS_DODGING_UP_SPEED STAT(DODGING_UP_SPEED, this) #define PHYS_DODGING_WALL STAT(DODGING_WALL, this) #define PHYS_DODGING_AIR STAT(DODGING_AIR, this) +#define PHYS_DODGING_MAXSPEED STAT(DODGING_MAXSPEED, this) #define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys #ifdef CSQC @@ -123,10 +124,18 @@ bool PM_dodging_checkpressedkeys(entity this) makevectors(this.angles); + bool wall_dodge = false; + if(!PHYS_DODGING_AIR) - if (check_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD) != 1 - && check_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD) != 1) - return true; + if(!check_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD)) + { + wall_dodge = check_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD); + if(!wall_dodge) // we're not on the ground, and wall dodging isn't allowed, end it! + return true; + } + + if(!wall_dodge && PHYS_DODGING_MAXSPEED && vdist(this.velocity, >, PHYS_DODGING_MAXSPEED)) + return false; float tap_direction_x = 0; float tap_direction_y = 0; diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index f14c9e717..a91aa5933 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -214,6 +214,7 @@ float autocvar_sv_dodging_ramp_time; float autocvar_sv_dodging_up_speed; bool autocvar_sv_dodging_wall_dodging; bool autocvar_sv_dodging_air_dodging; +float autocvar_sv_dodging_maxspeed = 450; #endif REGISTER_STAT(DODGING, int, g_dodging) @@ -230,6 +231,7 @@ REGISTER_STAT(DODGING_TIMEOUT, float) REGISTER_STAT(DODGING_UP_SPEED, float, autocvar_sv_dodging_up_speed) REGISTER_STAT(DODGING_WALL, bool, autocvar_sv_dodging_wall_dodging) REGISTER_STAT(DODGING_AIR, bool, autocvar_sv_dodging_air_dodging) +REGISTER_STAT(DODGING_MAXSPEED, float, autocvar_sv_dodging_maxspeed) REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side) REGISTER_STAT(JETPACK_ACCEL_UP, float, autocvar_g_jetpack_acceleration_up) -- 2.39.2