From 5fca80e59e89ea6deb5c79a7db4a03f13e33b15f Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 26 Dec 2023 13:33:10 -0600 Subject: [PATCH] Add UI screentips to spraycans (#80564) ## About The Pull Request This adds screentips to spraycans for: - AltClick - toggle cap - RMB - copy - LMB - paint ## Why It's Good For The Game Better UI/UX. ## Changelog :cl: qol: Add UI screentips to spraycans /:cl: --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- code/game/objects/items/crayons.dm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 5ba709ef324..35732e23101 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -762,6 +762,30 @@ /datum/component/slapcrafting,\ slapcraft_recipes = slapcraft_recipe_list,\ ) + register_context() + register_item_context() + +/obj/item/toy/crayon/spraycan/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) + . = ..() + + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) + return . + + if(has_cap) + context[SCREENTIP_CONTEXT_ALT_LMB] = "Toggle cap" + + return CONTEXTUAL_SCREENTIP_SET + +/obj/item/toy/crayon/spraycan/add_item_context(datum/source, list/context, atom/target, mob/living/user) + . = ..() + + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) + return . + + context[SCREENTIP_CONTEXT_LMB] = "Paint" + context[SCREENTIP_CONTEXT_RMB] = "Copy color" + + return CONTEXTUAL_SCREENTIP_SET /obj/item/toy/crayon/spraycan/isValidSurface(surface) return (isfloorturf(surface) || iswallturf(surface))