Files
Bubberstation/code/datums/screentips/atom_context.dm
SkyratBot d1cfb4338e [MIRROR] Contextual screentips -- Screentips now show you what items/objects can do [MDB IGNORE] (#11529)
* Contextual screentips -- Screentips now show you what items/objects can do (#64502)

Adds the foundational system for contextual screentips, which will show you what you can do with objects/items, including through context, such as what you are holding.

Provides several helper elements for most use cases, and applies it to a handful of common objects in order to show the full breadth of the system.

Changes screentips preference from on/off to on/off/only with context. Players who originally had it on off will have it migrated to only with context, though can re-disable it.

* Contextual screentips -- Screentips now show you what items/objects can do

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-02-15 23:48:07 +00:00

26 lines
1.2 KiB
Plaintext

/// Create a "Type-B" contextual screentip interaction, registering to `add_context()`.
/// This will run `add_context()` when the atom is hovered over by an item for context.
/// `add_context()` will *not* be called unless this is run.
/// This is not necessary for Type-B interactions, as you can just apply the flag and register to the signal yourself.
/atom/proc/register_context()
flags_1 |= HAS_CONTEXTUAL_SCREENTIPS_1
RegisterSignal(src, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, .proc/add_context)
/// Creates a "Type-B" contextual screentip interaction.
/// When a user hovers over this, this proc will be called in order
/// to provide context for contextual screentips.
/// You must call `register_context()` in order for this to be registered.
/// 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.
/// `source` can, in all cases, be replaced with `src`, and only exists because this proc directly connects to a signal.
/atom/proc/add_context(
atom/source,
list/context,
obj/item/held_item,
mob/living/user,
)
SIGNAL_HANDLER
return NONE