]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix air dodging to not go crazy high speeds, also decrease the default dodging delay...
authorMario <mario@smbclan.net>
Sat, 11 Mar 2017 15:08:54 +0000 (01:08 +1000)
committerMario <mario@smbclan.net>
Sat, 11 Mar 2017 15:08:54 +0000 (01:08 +1000)
mutators.cfg
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/stats.qh

index c272b5bd612f78e4e99c37d5f054f26f89902dc7..f61930852d0f9d75f6b66c241deb801a41032e9b 100644 (file)
@@ -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"
 
 
 // ===========
index fb1502dbc2102d3ec5c24c91f8f4ca705e673281..05201ebcff9eeaaf7921b743bac77bc45f6a2ff6 100644 (file)
@@ -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;
index f14c9e7170abb6d0beceb12403a6c4e762174d2b..a91aa59337e30effc62b5a0e20e90f869d75df99 100644 (file)
@@ -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)