Contextual screentips (and when to not use this folder)
Contextual screentips provide information in the form of text at the top of your screen to inform you of the possibilities of an item. The "contextual" here refers to this being handled entirely through code, what it displays and when is completely up to you. This folder provides several useful shortcuts to be able to handle 95% of situations. /datum/element/contextual_screentip_bare_hands This element is used to display screentips when the user hovers over the object with nothing in their active hand. It takes parameters in the form of both non-combat mode and, optionally, combat mode. Example:
This will display "LMB: Turn on | RMB: Turn off" when the user hovers over a fire alarm with an empty active hand. /datum/element/contextual_screentip_tools This element takes a map of tool behaviors to context lists. These will be displayed when the user hovers over the object with an item that has the tool behavior. Example:
This will display "RMB: Deconstruct" when the user hovers over a table with a wrench. /datum/element/contextual_screentip_item_typechecks This element takes a map of item typepaths to context lists. These will be displayed when the user hovers over the object with the selected item. Example:
This will display "LMB: Craft bola" when the user hovers over cable restraints with metal in their hand. The basic system acknowledges the following two interactions: These are items that are defined by their behavior. These should define their contextual text within themselves, and not in their targets.
These are objects (not necessarily items) that are defined by what happens to them. These should define their contextual text within themselves, and not in their operating tools.
Both of these are supported, and can be hooked to through several means. Note that you must return COMSIG_ITEM_REQUESTING_CONTEXT_FOR_TARGET This signal is registered on items, and receives the hovering object, provided in the form of /atom/proc/register_item_context() , and /atom/proc/add_item_context()
In order for your COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM This signal is registered on atoms, and receives what the user is hovering with, provided in the form of /atom/proc/register_context() , and /atom/proc/add_context()
In order for your When using any of these methods, you will receive a mutable context list. Context lists are lists with keys mapping from The signals and For example:
|