]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
anticheat: use servertime where appropriate (but AFAIK these don't
authorRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 07:41:29 +0000 (09:41 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 07:41:29 +0000 (09:41 +0200)
differ any more anyway)

qcsrc/server/anticheat.qc

index e45f9a0a7ca375386371e61dc745872f84ebc633..9a1872c89fadfb68d651babe38a85097dd1b9091 100644 (file)
@@ -84,7 +84,7 @@ void anticheat_physics()
        if(self.anticheat_div0_evade_offset == 0)
        {
                f = fabs(anticheat_div0_evade_evasion_delta - floor(anticheat_div0_evade_evasion_delta) - 0.5) * 2; // triangle function
-               self.anticheat_div0_evade_offset = time + sys_frametime * (3 * f - 1);
+               self.anticheat_div0_evade_offset = servertime + sys_frametime * (3 * f - 1);
                self.anticheat_div0_evade_v_angle = self.v_angle;
                self.anticheat_div0_evade_forward_initial = v_forward;
                MEAN_ACCUMULATE(anticheat_div0_evade, 0, 1);
@@ -144,13 +144,13 @@ void anticheat_physics()
 
        // new generic speedhack detection
        if (self.anticheat_speedhack_lasttime > 0) {
-               float dt = time - self.anticheat_speedhack_lasttime;
+               float dt = servertime - self.anticheat_speedhack_lasttime;
                const float falloff = 0.2;
                self.anticheat_speedhack_accu *= exp(-dt * falloff);
                self.anticheat_speedhack_accu += frametime * falloff;
                // NOTE: at cl_netfps x, this actually averages not to 1, but to 1/x * falloff / (1 - exp(-1/x * falloff))
                // For 15 netfps (absolute minimum bearable), and 0.2 falloff, this is: 1.0067
-               self.anticheat_speedhack_lasttime = time;
+               self.anticheat_speedhack_lasttime = servertime;
                MEAN_ACCUMULATE(anticheat_speedhack_m1, self.anticheat_speedhack_accu, frametime);
                MEAN_ACCUMULATE(anticheat_speedhack_m2, self.anticheat_speedhack_accu, frametime);
                MEAN_ACCUMULATE(anticheat_speedhack_m3, self.anticheat_speedhack_accu, frametime);
@@ -158,7 +158,7 @@ void anticheat_physics()
                MEAN_ACCUMULATE(anticheat_speedhack_m5, self.anticheat_speedhack_accu, frametime);
        } else {
                self.anticheat_speedhack_accu = 1;
-               self.anticheat_speedhack_lasttime = time;
+               self.anticheat_speedhack_lasttime = servertime;
        }
 
        // race/CTS: force kbd movement for fairness