From 4acc8c400580045704e20d310e4174ddf622ebc7 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 7 Aug 2024 17:33:15 +0000 Subject: [PATCH] Reduce the amount of unnecessary messages shown in the game chat Some engine messages are being printed to chat in scenarios where they may obscure regular game chat. To help with this, I've adjusted the visibility of them: - "unconnected changed name to BOT" and "BOT left the game" showing in chat have been disabled by only allowing such messages to show for real clients Bots will still show that they've been dropped in the console and Xonotic still shows a (dis)connect message - Verbose "Server lag report" messages (most commonly seen during map votes) have been moved to the console --- sv_ccmds.c | 2 +- sv_main.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sv_ccmds.c b/sv_ccmds.c index fa776ae5..64b3d197 100644 --- a/sv_ccmds.c +++ b/sv_ccmds.c @@ -870,7 +870,7 @@ void SV_Name(int clientnum) PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name); if (strcmp(host_client->old_name, host_client->name)) { - if (host_client->begun) + if (host_client->begun && host_client->netconnection) SV_BroadcastPrintf("\003%s ^7changed name to ^3%s\n", host_client->old_name, host_client->name); dp_strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name)); // send notification to all clients diff --git a/sv_main.c b/sv_main.c index 23649b51..d3ac0963 100644 --- a/sv_main.c +++ b/sv_main.c @@ -1081,11 +1081,12 @@ void SV_DropClient(qbool leaving, const char *fmt, ... ) // break the net connection NetConn_Close(host_client->netconnection); host_client->netconnection = NULL; + + if(fmt) + SV_BroadcastPrintf("\003^3%s left the game (%s)\n", host_client->name, reason); + else + SV_BroadcastPrintf("\003^3%s left the game\n", host_client->name); } - if(fmt) - SV_BroadcastPrintf("\003^3%s left the game (%s)\n", host_client->name, reason); - else - SV_BroadcastPrintf("\003^3%s left the game\n", host_client->name); // if a download is active, close it if (host_client->download_file) @@ -2569,7 +2570,7 @@ double SV_Frame(double time) } if (sv.perf_lost > 0 && reporting) - SV_BroadcastPrintf("\003" CON_WARN "Server lag report: %s\n", SV_TimingReport(vabuf, sizeof(vabuf))); + SV_BroadcastPrintf(CON_WARN "Server lag report: %s\n", SV_TimingReport(vabuf, sizeof(vabuf))); sv.perf_acc_realtime = sv.perf_acc_sleeptime = sv.perf_acc_lost = sv.perf_acc_offset = -- 2.39.2