diff --git a/code/datums/components/toggle_suit.dm b/code/datums/components/toggle_suit.dm index c4a378a16de..aee7522745e 100644 --- a/code/datums/components/toggle_suit.dm +++ b/code/datums/components/toggle_suit.dm @@ -15,6 +15,7 @@ return COMPONENT_INCOMPATIBLE var/atom/atom_parent = parent + atom_parent.flags_1 |= HAS_CONTEXTUAL_SCREENTIPS_1 src.toggle_noun = toggle_noun src.base_icon_state = atom_parent.base_icon_state || atom_parent.icon_state @@ -22,9 +23,10 @@ /datum/component/toggle_icon/RegisterWithParent() RegisterSignal(parent, COMSIG_CLICK_ALT, PROC_REF(on_click_alt)) RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) + RegisterSignal(parent, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_adding_context)) /datum/component/toggle_icon/UnregisterFromParent() - UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_ATOM_EXAMINE)) + UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_ATOM_EXAMINE, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM)) /* * Signal proc for COMSIG_CLICK_ALT. @@ -69,6 +71,21 @@ examine_list += span_notice("Alt-click on [source] to toggle the [toggle_noun].") +/* + * Signal proc for COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM. + * Adds usage context for toggling the parent open or closed. + * + * source - the atom context is requested from (parent) + * context - the list of usage contexts set + * held_item - the item held by the requesting mob + * user - the mob requesting context + */ +/datum/component/toggle_icon/proc/on_adding_context(atom/source, list/context, obj/item/held_item, mob/user) + SIGNAL_HANDLER + + context[SCREENTIP_CONTEXT_ALT_LMB] = "Toggle [toggle_noun]" + return CONTEXTUAL_SCREENTIP_SET + /* * Actually do the toggle of the icon. * Swaps the icon from [base_icon_state] to [base_icon_state]_t.