From: bones_was_here Date: Sun, 18 Apr 2021 10:05:49 +0000 (+1000) Subject: sv_maxidle*: Give players longer warning countdowns for longer timeouts X-Git-Tag: xonotic-v0.8.5~419^2~6 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=bbd8c31ea9339eb2d96cb05f34a034a18529d436;p=xonotic%2Fxonotic-data.pk3dir.git sv_maxidle*: Give players longer warning countdowns for longer timeouts 1/3 of timeout, or 10s, whichever is greater --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index d752eea36..c6c1ecf12 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2728,14 +2728,13 @@ void PlayerPostThink (entity this) if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0) maxidle_time = autocvar_sv_maxidle_playertospectator; float timeleft = ceil(maxidle_time - (time - CS(this).parm_idlesince)); - if (timeleft == min(10, maxidle_time - 1)) { // - 1 to support maxidle_time <= 10 - if (!CS(this).idlekick_lasttimeleft) - { - if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0) - Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOVETOSPEC_IDLING, timeleft); - else - Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft); - } + float countdown_time = max(min(10, maxidle_time - 1), ceil(maxidle_time * 0.33)); // - 1 to support maxidle_time <= 10 + if (timeleft == countdown_time && !CS(this).idlekick_lasttimeleft) + { + if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0) + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOVETOSPEC_IDLING, timeleft); + else + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft); } if (timeleft <= 0) { if (IS_PLAYER(this) && autocvar_sv_maxidle_playertospectator > 0) @@ -2752,8 +2751,8 @@ void PlayerPostThink (entity this) } return; } - else if (timeleft <= 10) { - if (timeleft != CS(this).idlekick_lasttimeleft) + else if (timeleft <= countdown_time) { + if (timeleft != CS(this).idlekick_lasttimeleft && timeleft <= 10) Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); CS(this).idlekick_lasttimeleft = timeleft; }