Skip to content

Commit

Permalink
Simplify chat grabber a bit by removing the unused circle feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioSMB committed Oct 30, 2024
1 parent 1752f88 commit 00fa2d3
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions mod/quake/server/chat_grabber.qc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
string autocvar_chat_dest_udp; // UDP protocol socket destination for caught chat messages
string autocvar__player_list; // internal list of player IPs, not to be shared
bool autocvar_chat_grabber_show_id = false; // show player IDs in the message
bool autocvar_chat_grabber_show_circle = false; // NOTE: doesn't work currently! show circle emoji behind each player to differentiate them
bool autocvar_chat_grabber_show_mapchange = true; // show map changes

const int CIRCLES = 8; // discord comes with 8 unique circle types
string chat_circles[CIRCLES] = {":blue_circle:", ":brown_circle:", ":green_circle:", ":orange_circle:", ":purple_circle:", ":red_circle:", ":white_circle:", ":yellow_circle:"};

STATIC_INIT_LATE(chat_grabber)
{
if(autocvar_chat_dest_udp == "")
Expand Down Expand Up @@ -36,19 +32,6 @@ void chat_grabber_PreFormatMessage(entity this, string msg)
string output = strdecolorize(msg);

string formatted = sprintf("<**%s**>: %s", nickname, output);
if(autocvar_chat_grabber_show_circle)
{
int chosen = (client.playerid - 1) % CIRCLES;
string mycircle = chat_circles[chosen];
// TODO: custom handler?
if(substring(nickname, 0, 5) == "Mario")
mycircle = ":circled_m:";
else if(nickname == "daro")
mycircle = ":wheel:";
else if(strstrofs(nickname, "Musicgoat", 0) >= 0)
mycircle = ":goat:";
formatted = strcat(mycircle, " ", formatted);
}
if(autocvar_chat_grabber_show_id)
formatted = sprintf("#%d %s", client.playerid, formatted);
sendto(autocvar_chat_dest_udp, formatted);
Expand Down Expand Up @@ -98,8 +81,6 @@ void chat_grabber_CheckClients()

// basically redo the entire list with the current players
// ensures no dangling references to players who leave mid-connect
cvar_set("_player_list", "");

string tmp_string = "";
FOREACH_CLIENT(IS_REAL_CLIENT(it),
{
Expand Down

0 comments on commit 00fa2d3

Please sign in to comment.