From: Mario Date: Sat, 15 Jul 2017 16:38:48 +0000 (+1000) Subject: Port idlekick_lasttimeleft to ClientState X-Git-Tag: xonotic-v0.8.5~2633 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=976e2ab8d154e70da6178e7b0f9d73bd720ddcd1;p=xonotic%2Fxonotic-data.pk3dir.git Port idlekick_lasttimeleft to ClientState --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 2f1630321..58bf67762 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; } } } diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 15c49034c..e82c413f6 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -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));