Files
Bubberstation/code/__DEFINES/dcs/signals/signals_screentips.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

36 lines
2.4 KiB
Plaintext

/// A "Type-A" contextual screentip interaction.
/// These are used for items that are defined by their behavior. They define their contextual text within *themselves*,
/// not in their targets.
/// Examples include syringes (LMB to inject, RMB to draw) and health analyzers (LMB to scan health/wounds, RMB for chems)
/// Items can override `add_item_context()`, and call `register_item_context()` in order to easily connect to this.
/// Called on /obj/item with a mutable screentip context list, the hovered target, and the mob hovering.
/// A screentip context list is a list that has context keys (SCREENTIP_CONTEXT_*, from __DEFINES/screentips.dm)
/// that map to the action as text.
/// If you mutate the list in this signal, you must return CONTEXTUAL_SCREENTIP_SET.
#define COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET "item_requesting_context_for_target"
/// A "Type-B" contextual screentip interaction.
/// These are atoms that are defined by what happens *to* them. These should define contextual text within themselves, and
/// not in their operating tools.
/// Examples include construction objects (LMB with glass to put in screen for computers).
/// Called on /atom with a mutable screentip context list, the item being used, and the mob hovering.
/// A screentip context list is a list that has context keys (SCREENTIP_CONTEXT_*, from __DEFINES/screentips.dm)
/// that map to the action as text.
/// If you mutate the list in this signal, you must return CONTEXTUAL_SCREENTIP_SET.
#define COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM "atom_requesting_context_from_item"
/// Tells the contextual screentips system that the list context was mutated.
#define CONTEXTUAL_SCREENTIP_SET (1 << 0)
/// A user screentip name override.
/// These are used for mobs that may override the names of atoms they hover over.
/// Examples include prosopagnosia (sees human names as Unknown regardless of what they are).
/// Called on /mob with a mutable screentip name list, the item being used, and the atom hovered over.
/// A screentip name override list is a list used for returning a string value from the signal. Only the first value matters.
/// If you mutate the list in this signal, you must return SCREENTIP_NAME_SET.
#define COMSIG_MOB_REQUESTING_SCREENTIP_NAME_FROM_USER "mob_requesting_screentip_name_from_user"
/// Tells the screentips system that the list names was mutated.
#define SCREENTIP_NAME_SET (1 << 0)