From 67e9cc47e3f0d6e20e44cdddd42e72b5b59260d9 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 10 Oct 2022 23:44:07 -0500 Subject: [PATCH] Add contextual screentips to jumpsuits (#70416) --- code/modules/clothing/under/_under.dm | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index b9b058948f5..b6ffff3400e 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -28,6 +28,33 @@ if(random_sensor) //make the sensor mode favor higher levels, except coords. sensor_mode = pick(SENSOR_VITALS, SENSOR_VITALS, SENSOR_VITALS, SENSOR_LIVING, SENSOR_LIVING, SENSOR_COORDS, SENSOR_COORDS, SENSOR_OFF) + register_context() + +/obj/item/clothing/under/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) + var/screentip_change = FALSE + + if(isnull(held_item) && has_sensor == HAS_SENSORS) + context[SCREENTIP_CONTEXT_RMB] = "Toggle suit sensors" + screentip_change = TRUE + + if(istype(held_item, /obj/item/clothing/accessory) && !attached_accessory) + var/obj/item/clothing/accessory/accessory = held_item + if(accessory.can_attach_accessory(src, user)) + context[SCREENTIP_CONTEXT_LMB] = "Attach accessory" + screentip_change = TRUE + + if(istype(held_item, /obj/item/stack/cable_coil) && has_sensor == BROKEN_SENSORS) + context[SCREENTIP_CONTEXT_LMB] = "Repair suit sensors" + screentip_change = TRUE + + if(attached_accessory) + context[SCREENTIP_CONTEXT_ALT_LMB] = "Remove accessory" + screentip_change = TRUE + else if(can_adjust) + context[SCREENTIP_CONTEXT_ALT_LMB] = adjusted == ALT_STYLE ? "Wear normally" : "Wear casually" + screentip_change = TRUE + + return screentip_change ? CONTEXTUAL_SCREENTIP_SET : NONE /obj/item/clothing/under/worn_overlays(mutable_appearance/standing, isinhands = FALSE) . = ..() @@ -47,7 +74,7 @@ C.use(1) has_sensor = HAS_SENSORS to_chat(user,span_notice("You repair the suit sensors on [src] with [C].")) - return 1 + return TRUE if(!attach_accessory(I, user)) return ..() @@ -89,7 +116,6 @@ if(ooman.w_uniform == src) ooman.update_suit_sensors() - /obj/item/clothing/under/visual_equipped(mob/user, slot) ..() if(adjusted)