From 9a4d3545e02b4c5bd6f36c4d0ee05a2a567be2e8 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 14 Apr 2023 15:58:39 -0500 Subject: [PATCH] Add contextual screentips, balloon alerts, and examine hints to lockers (#74681) ## About The Pull Request Gives lockers screentips, more balloon alerts, and examine hints to make interactions more obvious. ## Why It's Good For The Game Quality of life is good. ## Changelog :cl: qol: Add contextual screentips, balloon alerts, and examine hints to lockers /:cl: --- .../structures/crates_lockers/closets.dm | 41 ++++++++++++++----- .../crates_lockers/closets/secure/freezer.dm | 22 ---------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 6eff8c5ff1d..2fada65d116 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -92,6 +92,7 @@ COMSIG_ATOM_MAGICALLY_UNLOCKED = PROC_REF(on_magic_unlock), ) AddElement(/datum/element/connect_loc, loc_connections) + register_context() /obj/structure/closet/LateInitialize() . = ..() @@ -224,18 +225,37 @@ /obj/structure/closet/examine(mob/user) . = ..() - if(welded) - . += span_notice("It's welded shut.") - if(anchored) - . += span_notice("It is bolted to the ground.") - if(opened && cutting_tool == /obj/item/weldingtool) - . += span_notice("The parts are welded together.") - else if(secure && !opened) - . += span_notice("Right-click to [locked ? "unlock" : "lock"].") + + . += span_notice("It can be [EXAMINE_HINT("welded")] apart.") + . += span_notice("It can be [EXAMINE_HINT("bolted")] to the ground.") if(HAS_TRAIT(user, TRAIT_SKITTISH) && divable) . += span_notice("If you bump into [p_them()] while running, you will jump inside.") +/obj/structure/closet/add_context(atom/source, list/context, obj/item/held_item, mob/user) + . = ..() + var/screentip_change = FALSE + + if(isnull(held_item)) + if(secure && !broken) + context[SCREENTIP_CONTEXT_RMB] = opened ? "Lock" : "Unlock" + if(!welded) + context[SCREENTIP_CONTEXT_LMB] = opened ? "Close" : "Open" + screentip_change = TRUE + + if(istype(held_item) && held_item.tool_behaviour == TOOL_WELDER) + if(opened) + context[SCREENTIP_CONTEXT_LMB] = "Deconstruct" + else + context[SCREENTIP_CONTEXT_LMB] = welded ? "Unweld" : "Weld" + screentip_change = TRUE + + if(istype(held_item) && held_item.tool_behaviour == TOOL_WRENCH) + context[SCREENTIP_CONTEXT_RMB] = anchored ? "Unanchor" : "Anchor" + screentip_change = TRUE + + return screentip_change ? CONTEXTUAL_SCREENTIP_SET : NONE + /obj/structure/closet/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(wall_mounted) @@ -689,14 +709,15 @@ if(allowed(user)) if(iscarbon(user)) add_fingerprint(user) + balloon_alert_to_viewers(locked ? "unlocked" : "locked") locked = !locked user.visible_message(span_notice("[user] [locked ? null : "un"]locks [src]."), span_notice("You [locked ? null : "un"]lock [src].")) update_appearance() else if(!silent) - to_chat(user, span_alert("Access Denied.")) + balloon_alert(user, "access denied!") else if(secure && broken) - to_chat(user, span_warning("\The [src] is broken!")) + balloon_alert(user, "broken!") /obj/structure/closet/emag_act(mob/user) if(secure && !broken) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm b/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm index 59e847609fe..fc4b2c03321 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm @@ -7,10 +7,6 @@ /// If FALSE, we will protect the first person in the freezer from an explosion / nuclear blast. var/jones = FALSE -/obj/structure/closet/secure_closet/freezer/Initialize(mapload) - . = ..() - register_context() - /obj/structure/closet/secure_closet/freezer/Destroy() toggle_organ_decay(src) return ..() @@ -36,24 +32,6 @@ jones = TRUE flags_1 &= ~PREVENT_CONTENTS_EXPLOSION_1 -/obj/structure/closet/secure_closet/freezer/add_context( - atom/source, - list/context, - obj/item/held_item, - mob/living/user, -) - - if(isnull(held_item) || !opened) - return NONE - - if(held_item.tool_behaviour == TOOL_WELDER) - context[SCREENTIP_CONTEXT_LMB] = "Unweld" - return CONTEXTUAL_SCREENTIP_SET - -/obj/structure/closet/secure_closet/freezer/examine(mob/user) - . = ..() - . += span_notice("It can be [EXAMINE_HINT("welded")] apart.") - /obj/structure/closet/secure_closet/freezer/atom_destruction(damage_flag) new /obj/item/stack/sheet/iron(drop_location(), 1) new /obj/item/assembly/igniter/condenser(drop_location())