From 29c32994d68de0da10e021b141960fdd6d3b4e1c Mon Sep 17 00:00:00 2001 From: san7890 Date: Sun, 7 Dec 2025 20:05:33 -0700 Subject: [PATCH] Retinkers Multikey Message (#94357) ## About The Pull Request The slight imperfections of this were getting to me whenever I was testing stuff that required me have two different clients intializied so let's just retinker it a bit to look nicer without losing any functionality of the messaging service (as well as some explicit UX stuff to make it look less syntactically incorrect) Before: image After (colon missing at time of screenshot, fixed later): image Logged Version: ``` [2025-12-06 06:29:26.969] ADMINPRIVATE: MULTIKEY: Connecting player San7890 has the same !BOTH! IP 127.0.0.1 and Computer ID *********** as thesan7890 (no longer logged in) in the current round ``` ## Why It's Good For The Game Cleaner message that is still eyecatching for admins, uses string concats so it's less painful to modify in the future as well as reduce duplicated code while overall maintaining a pretty nice flow of message generation rather than be scattered all over the place. ## Changelog :cl: admin: Multikeying Notice Messages have taken on a new form factor but should still furnish the same information. /:cl: --- code/modules/client/client_procs.dm | 55 +++++++++++++++++++---------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 19bfebc0fe2..a80bfce45dc 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -322,30 +322,47 @@ GLOBAL_LIST_INIT(unrecommended_builds, list( if(!joined_player_preferences) continue //this shouldn't happen. - var/client/C = GLOB.directory[joined_player_ckey] - var/in_round = "" - if (joined_players[joined_player_ckey]) - in_round = " who has played in the current round" - var/message_type = "Notice" + var/client/potential_match = GLOB.directory[joined_player_ckey] + + var/matched_ip = null + var/matched_cid = null + var/same_round = FALSE - var/matches if(joined_player_preferences.last_ip == address) - matches += "IP ([address])" + matched_ip = "IP [address]" + if(joined_player_preferences.last_id == computer_id) - if(matches) - matches = "BOTH [matches] and " - alert_admin_multikey = TRUE - message_type = "MULTIKEY" - matches += "Computer ID ([computer_id])" + matched_cid = "Computer ID [computer_id]" alert_mob_dupe_login = TRUE - if(matches) - if(C) - message_admins(span_danger("[message_type]: Connecting player [key_name_admin(src)] has the same [matches] as [key_name_admin(C)][in_round].")) - log_admin_private("[message_type]: Connecting player [key_name(src)] has the same [matches] as [key_name(C)][in_round].") - else - message_admins(span_danger("[message_type]: Connecting player [key_name_admin(src)] has the same [matches] as [joined_player_ckey](no longer logged in)[in_round]. ")) - log_admin_private("[message_type]: Connecting player [key_name(src)] has the same [matches] as [joined_player_ckey](no longer logged in)[in_round].") + if(isnull(matched_ip) && isnull(matched_cid)) + continue + + if (joined_players[joined_player_ckey]) + same_round = TRUE + + var/double_match = !isnull(matched_ip) && !isnull(matched_cid) + + if(double_match && same_round) + alert_admin_multikey = TRUE + + var/list/concatables = list() + concatables += span_danger(span_bold("[double_match ? "MULTIKEY" : "Notice"]:")) + concatables += "Connecting player [key_name_admin(src)] has the same" + if(double_match) + concatables += "!BOTH! [matched_ip] and [matched_cid]" + else + concatables += (!isnull(matched_ip) ? matched_ip : matched_cid) + concatables += "as [isnull(potential_match) ? "[joined_player_ckey] (no longer logged in)" : "[key_name_admin(potential_match)]"]" + if(same_round) + concatables += span_bold("in the current round") + + concatables += "" + + var/sendable_string = jointext(concatables, " ") + + message_admins(sendable_string) + log_admin_private(strip_html_full(sendable_string, MAX_MESSAGE_LEN)) . = ..() //calls mob.Login()