]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Reduce the amount of unnecessary messages shown in the game chat
authorMario <mario.mario@y7mail.com>
Wed, 7 Aug 2024 17:33:15 +0000 (17:33 +0000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 7 Aug 2024 17:33:15 +0000 (17:33 +0000)
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
sv_main.c

index fa776ae55f45e1bf3825851701047793af408860..64b3d1977abe8a4ee628d3382f1a031e1cedd354 100644 (file)
@@ -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
index 23649b5110da324fa7e44ba95eb9e37904ed2f7f..d3ac09639d78a7ee3e0996472e77d9f37f5b2e57 100644 (file)
--- 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 =