]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/Mario/scoreboard_fixes', fixes #1974.
authorRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 09:13:06 +0000 (11:13 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 09:13:06 +0000 (11:13 +0200)
* origin/Mario/scoreboard_fixes:
  Hide accuracy while spectating or playing nexball, show current gametype in the "playing on" scoreboard info string, hide respawn countdown after match has ended

13 files changed:
qcsrc/common/notifications.qh
qcsrc/menu/xonotic/keybinder.c
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/mutator_spawn_near_teammate.qc
qcsrc/server/playerstats.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/w_minelayer.qc

index 003c0fcc1d64fc4fa0e112576e4342f5933b5d36..117965f7bb016aacb21fbb0ce5733197db86e231 100644 (file)
@@ -637,6 +637,7 @@ void Send_Notification_WOCOVA(
        MSG_CENTER_NOTIF(1, CENTER_JOIN_PREVENT,                0, 0, "",              CPID_PREVENT_JOIN,     "0 0", _("^K1You may not join the game at this time.\nThe player limit reached maximum capacity."), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_DROPPED,            1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has dropped the ball!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP,             1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has picked up the ball!"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP_SELF,        0, 0, "",              CPID_KEEPAWAY,         "0 0", _("^BGYou picked up the ball"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_WARN,               0, 0, "",              CPID_KEEPAWAY_WARN,    "0 0", _("^BGKilling people while you don't have the ball gives no points!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_HELP,                0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in your team's hands!\nHelp the key carriers to meet!"), "") \
        MULTITEAM_CENTER(1, CENTER_KEYHUNT_INTERFERE_, 4,       0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in ^TC^TT team^BG's hands!\nInterfere ^F4NOW^BG!"), "") \
index d16e8bb26ede658e06ded51df4cf0fe5ddce36d5..66c3486a3a91c22747a646153d64d181f4f14302 100644 (file)
@@ -143,6 +143,13 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
        if(key == K_ESCAPE)
                return;
 
+       // forbid these keys from being bound in the menu
+       if(key == K_CAPSLOCK || key == K_NUMLOCK)
+       {
+               KeyBinder_Bind_Change(me, me);
+               return;
+       }
+
        func = Xonotic_KeyBinds_Functions[me.selectedItem];
        if(func == "")
                return;
index d00c60b09d8b47134f9f0a18c94ac7d007bfa08d..9a1872c89fadfb68d651babe38a85097dd1b9091 100644 (file)
@@ -25,6 +25,8 @@ float mean_evaluate(entity e, .float a, .float c, float mean)
 #define MEAN_EVALUATE(prefix) mean_evaluate(self,prefix##_accumulator,prefix##_count,prefix##_mean)
 #define MEAN_DECLARE(prefix,m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
 
+.float anticheat_fixangle_endtime;
+
 float anticheat_div0_evade_evasion_delta;
 .float anticheat_div0_evade_offset;
 .vector anticheat_div0_evade_v_angle;
@@ -37,10 +39,32 @@ MEAN_DECLARE(anticheat_div0_strafebot_old, 5);
 .vector anticheat_div0_strafebot_forward_prev;
 MEAN_DECLARE(anticheat_div0_strafebot_new, 5);
 
+// Snap-aim detection: we track the average angular speed of aiming over time, in "radians per second".
+// Signal: a high-power mean. Cheaters will have high "signal" here.
+// Noise: a low-power mean. Active/shivery players will have high "noise" here.
+// Note one can always artificially add noise - so very high values of both signal and noise need to be checked too.
+MEAN_DECLARE(anticheat_idle_snapaim_signal, 5);
+MEAN_DECLARE(anticheat_idle_snapaim_noise, 1);
+
+// TEMP DEBUG STUFF.
+MEAN_DECLARE(anticheat_idle_snapaim_m2, 2);
+MEAN_DECLARE(anticheat_idle_snapaim_m3, 3);
+MEAN_DECLARE(anticheat_idle_snapaim_m4, 4);
+MEAN_DECLARE(anticheat_idle_snapaim_m7, 7);
+MEAN_DECLARE(anticheat_idle_snapaim_m10, 10);
+
 .float anticheat_speedhack_offset;
 .float anticheat_speedhack_movetime, anticheat_speedhack_movetime_count, anticheat_speedhack_movetime_frac;
 MEAN_DECLARE(anticheat_speedhack, 5);
 
+.float anticheat_speedhack_accu;
+.float anticheat_speedhack_lasttime;
+MEAN_DECLARE(anticheat_speedhack_m1, 1);
+MEAN_DECLARE(anticheat_speedhack_m2, 2);
+MEAN_DECLARE(anticheat_speedhack_m3, 3);
+MEAN_DECLARE(anticheat_speedhack_m4, 4);
+MEAN_DECLARE(anticheat_speedhack_m5, 5);
+
 float movement_oddity(vector m0, vector m1)
 {
        float cosangle = normalize(m0) * normalize(m1);
@@ -60,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);
@@ -75,8 +99,32 @@ void anticheat_physics()
        MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), 1);
        self.anticheat_div0_strafebot_movement_prev = self.movement;
 
-       if(vlen(self.anticheat_div0_strafebot_forward_prev))
-               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 0.5 - 0.5 * (self.anticheat_div0_strafebot_forward_prev * v_forward), 1);
+       // Note: this actually tries to detect snap-aim.
+       if(vlen(self.anticheat_div0_strafebot_forward_prev) && time > self.anticheat_fixangle_endtime) {
+               float cosangle = self.anticheat_div0_strafebot_forward_prev * v_forward;
+               float angle = cosangle < -1 ? M_PI : cosangle > 1 ? 0 : acos(cosangle);
+               /*
+               if (angle >= 10 * M_PI / 180)
+                       printf("SNAP %s: %f for %f, %f since fixangle\n", self.netname, angle * 180 / M_PI, cosangle, time - self.anticheat_fixangle_endtime);
+               */
+               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, angle / M_PI, 1);
+
+               if (autocvar_slowmo > 0) {
+                       // Technically this is a NOP, as the engine should be ensuring
+                       // this in the first place. Let's guard against dividing by
+                       // zero anyway.
+                       float dt = max(0.001, frametime) / autocvar_slowmo;
+
+                       float anglespeed = angle / dt;
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_signal, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_noise, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m2, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m3, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m4, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m7, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m10, anglespeed, dt);
+               }
+       }
        self.anticheat_div0_strafebot_forward_prev = v_forward;
 
        // generic speedhack detection: correlate anticheat_speedhack_movetime (UPDATED BEFORE THIS) and server time
@@ -94,6 +142,25 @@ void anticheat_physics()
                self.anticheat_speedhack_offset += (f - self.anticheat_speedhack_offset) * frametime * 0.1;
        }
 
+       // new generic speedhack detection
+       if (self.anticheat_speedhack_lasttime > 0) {
+               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 = 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);
+               MEAN_ACCUMULATE(anticheat_speedhack_m4, self.anticheat_speedhack_accu, frametime);
+               MEAN_ACCUMULATE(anticheat_speedhack_m5, self.anticheat_speedhack_accu, frametime);
+       } else {
+               self.anticheat_speedhack_accu = 1;
+               self.anticheat_speedhack_lasttime = servertime;
+       }
+
        // race/CTS: force kbd movement for fairness
        if(g_race || g_cts)
        {
@@ -168,15 +235,69 @@ void anticheat_report()
 {
        if(!autocvar_sv_eventlog)
                return;
+       // TODO(divVerent): Use xonstat to acquire good thresholds.
        GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - self.anticheat_jointime)));
        GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m1), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m2), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m3), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m4), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m5), 240, 0.1, 0.15)));
        GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_old), 120, 0.3, 0.4)));
        GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_new), 120, 0.3, 0.4)));
        GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_evade), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m2), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m3), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m4), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m7), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m10), 120, 0.1, 0.2)));
+}
+
+float anticheat_getvalue(string id)
+{
+       switch(id) {
+               case "_time": return servertime - self.anticheat_jointime;
+               case "speedhack": return MEAN_EVALUATE(anticheat_speedhack);
+               case "speedhack_m1": return MEAN_EVALUATE(anticheat_speedhack_m1);
+               case "speedhack_m2": return MEAN_EVALUATE(anticheat_speedhack_m2);
+               case "speedhack_m3": return MEAN_EVALUATE(anticheat_speedhack_m3);
+               case "speedhack_m4": return MEAN_EVALUATE(anticheat_speedhack_m4);
+               case "speedhack_m5": return MEAN_EVALUATE(anticheat_speedhack_m5);
+               case "div0_strafebot_old": return MEAN_EVALUATE(anticheat_div0_strafebot_old);
+               case "div0_strafebot_new": return MEAN_EVALUATE(anticheat_div0_strafebot_new);
+               case "div0_evade": return MEAN_EVALUATE(anticheat_div0_evade);
+               case "idle_snapaim": return MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise);
+               case "idle_snapaim_signal": return MEAN_EVALUATE(anticheat_idle_snapaim_signal);
+               case "idle_snapaim_noise": return MEAN_EVALUATE(anticheat_idle_snapaim_noise);
+               case "idle_snapaim_m2": return MEAN_EVALUATE(anticheat_idle_snapaim_m2);
+               case "idle_snapaim_m3": return MEAN_EVALUATE(anticheat_idle_snapaim_m3);
+               case "idle_snapaim_m4": return MEAN_EVALUATE(anticheat_idle_snapaim_m4);
+               case "idle_snapaim_m7": return MEAN_EVALUATE(anticheat_idle_snapaim_m7);
+               case "idle_snapaim_m10": return MEAN_EVALUATE(anticheat_idle_snapaim_m10);
+       }
+       return -1;
+}
+
+void anticheat_startframe()
+{
+       anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
+}
+
+void anticheat_fixangle()
+{
+       self.anticheat_fixangle_endtime = servertime + ANTILAG_LATENCY(self) + 0.2;
 }
 
-void anticheat_serverframe()
+void anticheat_endframe()
 {
+       entity oldself = self;
+       FOR_EACH_CLIENT(self)
+               if (self.fixangle)
+                       anticheat_fixangle();
+       self = oldself;
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
 }
 
index 80c7636a0b6852a86d1b35d36e84ff87e2e15f5f..e46dcce7b2051a8af3e8e847975d76e41b5079f3 100644 (file)
@@ -6,4 +6,9 @@ void anticheat_physics();
 void anticheat_spectatecopy(entity spectatee);
 void anticheat_prethink();
 
-void anticheat_serverframe();
+float anticheat_getvalue(string name);
+
+void anticheat_startframe();
+void anticheat_endframe();
+
+void anticheat_fixangle();
index 0d0dd3138aa9600e06e0aef3fb152d6410d30987..43c7be517958e718b864f25bbf46e699b741c90d 100644 (file)
@@ -19,6 +19,9 @@ When you press the jump key
 */
 void PlayerJump (void)
 {
+       if(self.player_blocked)
+               return; // no jumping while blocked
+
        float doublejump = FALSE;
 
        player_multijump = doublejump;
index 67738c4c6c0d28fb4c59a960203330356dd1567a..05a3b4544fe9ecfcd8892d6faf15a3ad0e410a0a 100644 (file)
@@ -673,15 +673,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                Portal_ClearAllLater(self);
 
-               if(IS_REAL_CLIENT(self))
-               {
-                       self.fixangle = TRUE;
-                       //msg_entity = self;
-                       //WriteByte (MSG_ONE, SVC_SETANGLE);
-                       //WriteAngle (MSG_ONE, self.v_angle_x);
-                       //WriteAngle (MSG_ONE, self.v_angle_y);
-                       //WriteAngle (MSG_ONE, 80);
-               }
+               self.fixangle = TRUE;
 
                if(defer_ClientKill_Now_TeamChange)
                        ClientKill_Now_TeamChange(); // can turn player into spectator
index 875a0c3e6a4a2404354747de17734d43cbebc408..c779f9d4bedc1e3a4ec8c50d946b62c18c8a3e4e 100644 (file)
@@ -2730,6 +2730,8 @@ string GotoMap(string m)
 
 void EndFrame()
 {
+       anticheat_endframe();
+
        float altime;
        FOR_EACH_REALCLIENT(self)
        {
index ec6ee8cd4c6d83b60ef19dec2e9d575439fb9127..942682c16ff060435497cf6ea7a5bd526bd03ea3 100644 (file)
@@ -25,28 +25,28 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
-       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
+       if(!MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
        {
-               makevectors(self.angles);
-               self.movetype = MOVETYPE_BOUNCE;
-               self.velocity = '0 0 200';
-               self.angles = '0 0 0';
-               self.effects = autocvar_g_keepawayball_effects;
-               self.think = ka_RespawnBall;
-               self.nextthink = time + autocvar_g_keepawayball_respawntime;
+               entity spot = SelectSpawnPoint(TRUE);
+               setorigin(self, spot.origin);
+               self.angles = spot.angles;
+       }
 
-               pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
-               pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
+       makevectors(self.angles);
+       self.movetype = MOVETYPE_BOUNCE;
+       self.velocity = '0 0 200';
+       self.angles = '0 0 0';
+       self.effects = autocvar_g_keepawayball_effects;
+       self.think = ka_RespawnBall;
+       self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
-               WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
-               WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+       pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
+       pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
 
-               sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
-       }
-       else
-       {
-               ka_RespawnBall(); // finding a location failed, retry
-       }
+       WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
+       WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+
+       sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
 void ka_TimeScoring()
@@ -102,7 +102,8 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        // messages and sounds
        ka_EventLog("pickup", other);
        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname);
-       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF);
        sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 
        // scoring
index 54df3a97cdcaa22f101fedaf9c8c80bcde358438..e53c80f848cca975344b6e2025076bdecfec6c33 100644 (file)
@@ -41,6 +41,7 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
 
 MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
 {
+       // Note: when entering this, fixangle is already set.
        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
@@ -112,7 +113,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                                                                                setorigin(self, trace_endpos);
                                                                                self.angles = team_mate.angles;
                                                                                self.angles_z = 0; // never spawn tilted even if the spot says to
-                                                                               self.fixangle = TRUE; // turn this way immediately
                                                                                team_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
                                                                                return 0;
                                                                        }
@@ -130,7 +130,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                        setorigin(self, best_spot);
                        self.angles = best_mate.angles;
                        self.angles_z = 0; // never spawn tilted even if the spot says to
-                       self.fixangle = TRUE; // turn this way immediately
                        best_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
                }
        }
@@ -139,7 +138,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
                self.angles_x = -self.angles_x;
                self.angles_z = 0; // never spawn tilted even if the spot says to
-               self.fixangle = TRUE; // turn this way immediately
                /*
                sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
                sprint(self, "distance: ", vtos(spawn_spot.msnt_lookat.origin - self.origin), "\n");
index 2c6e941a6a4dfd7585986ea74c969702e8609b81..3186b1aa3b432f9060ac130554895e419e13c29e 100644 (file)
@@ -5,6 +5,26 @@ string events_last;
 .float playerstats_addedglobalinfo;
 .string playerstats_id;
 
+#define ALL_ANTICHEATS \
+       ANTICHEAT("_time"); \
+       ANTICHEAT("speedhack"); \
+       ANTICHEAT("speedhack_m1"); \
+       ANTICHEAT("speedhack_m2"); \
+       ANTICHEAT("speedhack_m3"); \
+       ANTICHEAT("speedhack_m4"); \
+       ANTICHEAT("speedhack_m5"); \
+       ANTICHEAT("div0_strafebot_old"); \
+       ANTICHEAT("div0_strafebot_new"); \
+       ANTICHEAT("div0_evade"); \
+       ANTICHEAT("idle_snapaim"); \
+       ANTICHEAT("idle_snapaim_signal"); \
+       ANTICHEAT("idle_snapaim_noise"); \
+       ANTICHEAT("idle_snapaim_m2"); \
+       ANTICHEAT("idle_snapaim_m3"); \
+       ANTICHEAT("idle_snapaim_m4"); \
+       ANTICHEAT("idle_snapaim_m7"); \
+       ANTICHEAT("idle_snapaim_m10");
+
 void PlayerStats_Init() // initiated before InitGameplayMode so that scores are added properly
 {
        string uri;
@@ -44,6 +64,11 @@ void PlayerStats_Init() // initiated before InitGameplayMode so that scores are
         PlayerStats_AddEvent(strcat("acc-", w.netname, "-frags"));
     }
 
+#define ANTICHEAT(name) \
+       PlayerStats_AddEvent("anticheat-" name)
+       ALL_ANTICHEATS
+#undef ANTICHEAT
+
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3);
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5);
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10);
@@ -356,6 +381,18 @@ void PlayerStats_Accuracy(entity p)
     //backtrace(strcat("adding player stat accuracy for ", p.netname, ".\n"));
 }
 
+void PlayerStats_Anticheat(entity p)
+{
+       entity oldself = self;
+       self = p;
+
+#define ANTICHEAT(name) \
+       PlayerStats_Event(p, "anticheat-" name, anticheat_getvalue(name))
+       ALL_ANTICHEATS
+#undef ANTICHEAT
+       self = oldself;
+}
+
 void PlayerStats_AddGlobalInfo(entity p)
 {
        if(playerstats_db < 0)
@@ -384,6 +421,8 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        PlayerStats_Accuracy(p);
 
+       PlayerStats_Anticheat(p);
+
        if(IS_REAL_CLIENT(p))
        {
                if(p.latency_cnt)
@@ -430,3 +469,5 @@ void PlayerStats_EndMatch(float finished)
                }
        }
 }
+
+#undef ALL_ANTICHEATS
index 920f738aeebbeb8a321dd3456e33e8af4bb1a6c9..73e733be8f97d927c521c62a48751cfa0ca88c48 100644 (file)
@@ -238,6 +238,8 @@ void StartFrame (void)
        FOR_EACH_PLAYER(self)
                self.porto_forbidden = max(0, self.porto_forbidden - 1);
 
+       anticheat_startframe();
+
        MUTATOR_CALLHOOK(SV_StartFrame);
 }
 
index 8f15a4f820c428c976ca17d5871ce178d99b9b6e..6e7c35b6a662f7f75ac5d6a5578d7da56517f103 100644 (file)
@@ -338,6 +338,12 @@ void spawnfunc_trigger_teleport (void)
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
 {
        UpdateCSQCProjectileAfterTeleport(pl);
+       {
+               entity oldself = self;
+               self = pl;
+               anticheat_fixangle();
+               self = oldself;
+       }
        // "disown" projectiles after teleport
        if(pl.owner)
        if(pl.owner == pl.realowner)
index 5d88df8b254ac08be41bcec0422d0af8a464a34c..ec36f5d32541cea2fbca1c8fa29572b0e1994d06 100644 (file)
@@ -195,7 +195,7 @@ void W_Mine_Think (void)
 
        // a player's mines shall explode if he disconnects or dies
        // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
-       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO)
+       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO || self.realowner.freezetag_frozen)
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
@@ -207,7 +207,7 @@ void W_Mine_Think (void)
        head = findradius(self.origin, autocvar_g_balance_minelayer_proximityradius);
        while(head)
        {
-               if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
+               if(IS_PLAYER(head) && head.deadflag == DEAD_NO && !head.freezetag_frozen)
                if(head != self.realowner && DIFF_TEAM(head, self.realowner)) // don't trigger for team mates
                if(!self.mine_time)
                {