]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port idlekick_lasttimeleft to ClientState
authorMario <mario@smbclan.net>
Sat, 15 Jul 2017 16:38:48 +0000 (02:38 +1000)
committerMario <mario@smbclan.net>
Sat, 15 Jul 2017 16:38:48 +0000 (02:38 +1000)
qcsrc/server/client.qc
qcsrc/server/client.qh

index 2f16303210038d9a869d137745f2abfaf2283468..58bf67762fe2f852de1b335aaab134dff74170b7 100644 (file)
@@ -2664,7 +2664,6 @@ PlayerPostThink
 Called every frame for each client after the physics are run
 =============
 */
-.float idlekick_lasttimeleft;
 void PlayerPostThink (entity this)
 {
        Player_Physics(this);
@@ -2687,9 +2686,9 @@ void PlayerPostThink (entity this)
                { /* do nothing */ }
                else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
-                       if (this.idlekick_lasttimeleft)
+                       if (CS(this).idlekick_lasttimeleft)
                        {
-                               this.idlekick_lasttimeleft = 0;
+                               CS(this).idlekick_lasttimeleft = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
                        }
                }
@@ -2697,7 +2696,7 @@ void PlayerPostThink (entity this)
                {
                        float timeleft = ceil(sv_maxidle - (time - CS(this).parm_idlesince));
                        if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
-                               if (!this.idlekick_lasttimeleft)
+                               if (!CS(this).idlekick_lasttimeleft)
                                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
                        if (timeleft <= 0) {
@@ -2706,10 +2705,10 @@ void PlayerPostThink (entity this)
                                return;
                        }
                        else if (timeleft <= 10) {
-                               if (timeleft != this.idlekick_lasttimeleft) {
+                               if (timeleft != CS(this).idlekick_lasttimeleft) {
                                    Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
                 }
-                               this.idlekick_lasttimeleft = timeleft;
+                               CS(this).idlekick_lasttimeleft = timeleft;
                        }
                }
        }
index 15c49034c135fb5a12e4138677feaf90ac2adecf..e82c413f6fa6969406d9881a0e98eb20a0a3b982 100644 (file)
@@ -36,6 +36,7 @@ CLASS(Client, Object)
     ATTRIB(Client, parm_idlesince, int, this.parm_idlesince);
     ATTRIB(Client, muted, bool, this.muted);
     ATTRIB(Client, killindicator_teamchange, int, this.killindicator_teamchange);
+    ATTRIB(Client, idlekick_lasttimeleft, float, this.idlekick_lasttimeleft);
 
     METHOD(Client, m_unwind, bool(Client this));