From 0cfb6bf4fe1db0b61e6d0bd92565742fef216ca4 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Wed, 17 Jul 2024 21:15:54 +0100 Subject: [PATCH] Ghosts once again can see people's true names and roundstart jobs (#84951) ## About The Pull Request #83186 made it so ghosts are fooled by disguises, like wearing a mask and an ID. This PR fixes that behavior, instead always displaying the person's real name and their face/ID name (if their face name is somehow different from real name) in brackets. Additionally, this PR makes orbit menu prioritize "real" job name and icon, aka the ones the person spawned with. If they don't have an assigned job, it will fall back to current behavior of looking it up from their ID. Also, searching people includes both their fake and real name. ## Why It's Good For The Game Ghosts really, really shouldn't be fooled by wearing a gas mask and an ID. **Especially** admin ghosts. ## Changelog :cl: qol: Ghost orbit menu now always displays person's real name and their roundstart job and cannot be fooled by disguises. /:cl: --- code/game/atom/atom_examine.dm | 3 ++- code/modules/mob/dead/observer/orbit.dm | 22 ++++++++++++++---- .../mob/living/carbon/human/human_helpers.dm | 18 ++++++++++++--- .../tgui/interfaces/Orbit/JobIcon.tsx | 11 +++++---- .../tgui/interfaces/Orbit/OrbitBlade.tsx | 23 +++++++++++++++++-- .../interfaces/Orbit/OrbitCollapsible.tsx | 6 +++-- .../tgui/interfaces/Orbit/OrbitItem.tsx | 9 +++++--- .../tgui/interfaces/Orbit/OrbitSearchBar.tsx | 13 +++++++++++ .../tgui/interfaces/Orbit/OrbitTooltip.tsx | 10 ++++---- .../packages/tgui/interfaces/Orbit/helpers.ts | 3 ++- tgui/packages/tgui/interfaces/Orbit/index.tsx | 5 ++++ tgui/packages/tgui/interfaces/Orbit/types.ts | 2 ++ .../tgui/styles/interfaces/Orbit.scss | 2 +- 13 files changed, 101 insertions(+), 26 deletions(-) diff --git a/code/game/atom/atom_examine.dm b/code/game/atom/atom_examine.dm index 8df52eb9cb0..8d952ae5bfa 100644 --- a/code/game/atom/atom_examine.dm +++ b/code/game/atom/atom_examine.dm @@ -113,5 +113,6 @@ return name_chaser /// Used by mobs to determine the name for someone wearing a mask, or with a disfigured or missing face. By default just returns the atom's name. add_id_name will control whether or not we append "(as [id_name])". -/atom/proc/get_visible_name(add_id_name) +/// force_real_name will always return real_name and add (as face_name/id_name) if it doesn't match their appearance +/atom/proc/get_visible_name(add_id_name, force_real_name) return name diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index ee0b4528995..bdb0b7ce37e 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -211,14 +211,26 @@ GLOBAL_DATUM_INIT(orbit_menu, /datum/orbit_menu, new) if(issilicon(player)) serialized["job"] = player.job serialized["icon"] = "borg" - else - var/obj/item/card/id/id_card = player.get_idcard(hand_first = FALSE) - serialized["job"] = id_card?.get_trim_assignment() - serialized["icon"] = id_card?.get_trim_sechud_icon_state() + return serialized + var/obj/item/card/id/id_card = player.get_idcard(hand_first = FALSE) + serialized["job"] = id_card?.get_trim_assignment() + serialized["icon"] = id_card?.get_trim_sechud_icon_state() + + var/datum/job/job = player.mind?.assigned_role + if (isnull(job)) + return serialized + + serialized["mind_job"] = job.title + var/datum/outfit/outfit = job.get_outfit() + if (isnull(outfit)) + return serialized + + var/datum/id_trim/trim = outfit.id_trim + if (!isnull(trim)) + serialized["mind_icon"] = trim::sechud_icon_state return serialized - /// Gets a list: Misc data and whether it's critical. Handles all snowflakey type cases /datum/orbit_menu/proc/get_misc_data(atom/movable/atom_poi) as /list var/list/misc = list() diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index 728ff63c03c..8541f4f7424 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -57,15 +57,27 @@ return if_no_id //repurposed proc. Now it combines get_id_name() and get_face_name() to determine a mob's name variable. Made into a separate proc as it'll be useful elsewhere -/mob/living/carbon/human/get_visible_name(add_id_name = TRUE) - if(HAS_TRAIT(src, TRAIT_UNKNOWN)) - return "Unknown" +/mob/living/carbon/human/get_visible_name(add_id_name = TRUE, force_real_name = FALSE) var/list/identity = list(null, null) SEND_SIGNAL(src, COMSIG_HUMAN_GET_VISIBLE_NAME, identity) var/signal_face = LAZYACCESS(identity, VISIBLE_NAME_FACE) var/signal_id = LAZYACCESS(identity, VISIBLE_NAME_ID) var/face_name = !isnull(signal_face) ? signal_face : get_face_name("") var/id_name = !isnull(signal_id) ? signal_id : get_id_name("") + if (force_real_name) + var/fake_name + if (face_name && face_name != real_name) + fake_name = face_name + if(add_id_name && id_name && id_name != real_name) + if (!isnull(fake_name) && id_name != face_name) + fake_name = "[fake_name]/[id_name]" + else + fake_name = id_name + if (HAS_TRAIT(src, TRAIT_UNKNOWN) || (!face_name && !id_name)) + fake_name = "Unknown" + return "[real_name][fake_name ? " (as [fake_name])" : ""]" + if(HAS_TRAIT(src, TRAIT_UNKNOWN)) + return "Unknown" if(face_name) if(add_id_name && id_name && (id_name != face_name)) return "[face_name] (as [id_name])" diff --git a/tgui/packages/tgui/interfaces/Orbit/JobIcon.tsx b/tgui/packages/tgui/interfaces/Orbit/JobIcon.tsx index 2d584bfc6b1..713d82eacee 100644 --- a/tgui/packages/tgui/interfaces/Orbit/JobIcon.tsx +++ b/tgui/packages/tgui/interfaces/Orbit/JobIcon.tsx @@ -4,6 +4,7 @@ import { Antagonist, Observable } from './types'; type Props = { item: Observable | Antagonist; + realNameDisplay: boolean; }; type IconSettings = { @@ -22,7 +23,7 @@ const antagIcon: IconSettings = { }; export function JobIcon(props: Props) { - const { item } = props; + const { item, realNameDisplay } = props; let iconSettings: IconSettings; if ('antag' in item) { @@ -32,16 +33,18 @@ export function JobIcon(props: Props) { } // We don't need to cast here but typescript isn't smart enough to know that - const { icon = '', job = '' } = item; + const { icon = '', job = '', mind_icon = '', mind_job = '' } = item; + const usedIcon = realNameDisplay ? mind_icon || icon : icon; + const usedJob = realNameDisplay ? mind_job || job : job; return (