From f03ef02a03bebb3df2a88f1a9ea1b989a2023a5c Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sat, 19 Aug 2017 16:13:07 +0200 Subject: [PATCH] fix +dodge being unfair for walldodging --- mutators.cfg | 2 +- qcsrc/common/mutators/mutator/dodging/sv_dodging.qc | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mutators.cfg b/mutators.cfg index 997d19b99..0f220464f 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.5 "determines how long a player has to wait to be able to dodge again after dodging" +set sv_dodging_delay 0.6 "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_min 200 "the lower bound of current velocity for force scaling" set sv_dodging_horiz_speed_max 1000 "the upper bound of current velocity for force scaling" diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 8dd93fdb5..59b932f41 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -144,10 +144,6 @@ float determine_force(entity player) { bool PM_dodging_checkpressedkeys(entity this) { - // first check if the last dodge is far enough back in time so we can dodge again - if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY) - return false; - bool frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this)); bool frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_DOUBLETAP); @@ -178,9 +174,15 @@ bool PM_dodging_checkpressedkeys(entity this) #undef X if (!dodge_detected) return false; - //LOG_INFOF("dodge keys detected %f, speed %f\n", time, vlen(this.velocity)); + // this check has to be after checking keys: + // the first key press of the double tap is allowed to be before dodging delay, + // only the second has to be after, otherwise +dodge gives an advantage because typical repress time is 0.1 s + // or higher which means players using +dodge would be able to do it more often + if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY) + return false; + makevectors(this.angles); bool can_dodge = (is_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD) && (PHYS_DODGING_MAXSPEED == 0 || vdist(this.velocity, <, PHYS_DODGING_MAXSPEED))); -- 2.39.2