From: terencehill Date: Thu, 25 Aug 2016 09:15:17 +0000 (+0200) Subject: Fix CENTER_JOIN_PREVENT message spam while you keep pressed the join key X-Git-Tag: xonotic-v0.8.2~620^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0fba4a3a525f280b6d6e6e60016c6072d0f99d69;p=xonotic%2Fxonotic-data.pk3dir.git Fix CENTER_JOIN_PREVENT message spam while you keep pressed the join key --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index d30c10feb..b2fee6690 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1920,13 +1920,20 @@ int nJoinAllowed(entity this, entity ignore) ++currentlyPlaying; )); + float free_slots = 0; if (!autocvar_g_maxplayers) - return maxclients - totalClients; + free_slots = maxclients - totalClients; + else if(currentlyPlaying < autocvar_g_maxplayers) + free_slots = min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying); - if(currentlyPlaying < autocvar_g_maxplayers) - return min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying); + static float join_prevent_msg_time = 0; + if(ignore && !free_slots && time > join_prevent_msg_time) + { + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT); + join_prevent_msg_time = time + 3; + } - return 0; + return free_slots; } /** @@ -1998,12 +2005,7 @@ bool spawnAllowed(entity this) if (this.version_mismatch) return false; if (teamplay && lockteams) return false; if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false; - if (!nJoinAllowed(this, this)) - { - // Player may not join because g_maxplayers is set - Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT); - return false; - } + if (!nJoinAllowed(this, this)) return false; return true; }