From: Rudolf Polzer Date: Wed, 4 Jun 2014 07:41:29 +0000 (+0200) Subject: anticheat: use servertime where appropriate (but AFAIK these don't X-Git-Tag: xonotic-v0.8.0~209 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c775b2509085ef2b0d5fa92d0548e3a190a28d42;p=xonotic%2Fxonotic-data.pk3dir.git anticheat: use servertime where appropriate (but AFAIK these don't differ any more anyway) --- diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index e45f9a0a7..9a1872c89 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -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