Files
Bubberstation/code/datums/quirks/negative_quirks/prosopagnosia.dm
_0Steven c5cc9ea00a Fixes prosopagnosia not working with screentips (bitflag&signal edition) (#86980)
## About The Pull Request

So previously I made a pr for fixing the prosopagnosia quirk, but the
code I wrote was far too ass for what was already incredibly hot code.
In the comments, Mothblocks requested using the same bitflag&signal
logic the other screentip modifiers use.

![image](https://github.com/user-attachments/assets/cd26ab56-f1e8-4be3-a847-5a4509d312c1)
I, of course, said I'd look into it in a few days.

Anyhow, 199 days later, I've made this pr.

Here we introduce a new `mob_flags` var on `/mob`, where we set
`MOB_HAS_SCREENTIPS_NAME_OVERRIDE`.
Then, based on whether this is set, the screentips system sends a signal
to the user mob to request possible name overrides.
We then make the prosopagnosia quirk set this flag and register the
signal, upon which it just sets the name to "Unknown" if it's a human.

This fixes our issues (in a saner way).
## Why It's Good For The Game

Better is prosopagnosia can't be easily obviated by just having
screentips on.
## Changelog
🆑
fix: Prosopagnosia actually accounts for hover screentips, showing
humans as Unknown in those too.
/🆑
2024-11-11 00:41:54 -08:00

26 lines
1019 B
Plaintext

/datum/quirk/prosopagnosia
name = "Prosopagnosia"
desc = "You have a mental disorder that prevents you from being able to recognize faces at all."
icon = FA_ICON_USER_SECRET
value = -4
mob_trait = TRAIT_PROSOPAGNOSIA
medical_record_text = "Patient suffers from prosopagnosia and cannot recognize faces."
hardcore_value = 5
mail_goodies = list(/obj/item/skillchip/appraiser) // bad at recognizing faces but good at recognizing IDs
/datum/quirk/prosopagnosia/add(client/client_source)
RegisterSignal(quirk_holder, COMSIG_MOB_REQUESTING_SCREENTIP_NAME_FROM_USER, PROC_REF(screentip_name_override))
quirk_holder.mob_flags |= MOB_HAS_SCREENTIPS_NAME_OVERRIDE
/datum/quirk/prosopagnosia/remove()
UnregisterSignal(quirk_holder, COMSIG_MOB_REQUESTING_SCREENTIP_NAME_FROM_USER)
/datum/quirk/prosopagnosia/proc/screentip_name_override(datum/source, list/returned_name, obj/item/held_item, atom/hovered)
SIGNAL_HANDLER
if(!ishuman(hovered))
return NONE
returned_name[1] = "Unknown"
return SCREENTIP_NAME_SET