]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
fix +dodge being unfair for walldodging
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / dodging / sv_dodging.qc
index 8dd93fdb5591b781c01d90834dc27fc0316257e3..59b932f418d3c31e3b3239c43f9a845fc75380bd 100644 (file)
@@ -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)));