From e73dc13a29c34c5065462ea14653996e4ba40c68 Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Fri, 26 Apr 2024 20:00:51 -0400 Subject: [PATCH] Improves interactions with display cases. (#25228) * better player info for display case * this too * improved messaging * finish out the docs * Update code/game/objects/structures/displaycase.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com> --------- Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> --- code/game/objects/structures/displaycase.dm | 74 ++++++++++++++------- 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 5bee6f32e4a..f367879cae3 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -9,13 +9,22 @@ armor = list(MELEE = 30, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 10, RAD = 0, FIRE = 70, ACID = 100) max_integrity = 200 integrity_failure = 50 - var/obj/item/showpiece = null - var/alert = FALSE //Basic display cases have no alarms + /// The object stored inside. + var/obj/item/showpiece + /// If true, this is alarmed and will set off a siren when opened without proper access. + var/alert = FALSE + /// If this is currently unlocked var/open = FALSE + /// If false, this can never be opened, and the item inside should be inaccessible. Good for showcases. var/openable = TRUE + /// The electronics currently installed in this showpiece. var/obj/item/airlock_electronics/electronics - var/start_showpiece_type = null //add type for items on display - var/list/start_showpieces = list() //Takes sublists in the form of list("type" = /obj/item/bikehorn, "trophy_message" = "henk") + /// The type that should be instantiated to fill the showpiece. + var/start_showpiece_type + /// A list of random items that could possibly fill the case, as well as a flavor message for them. + /// Takes sublists in the form of list("type" = /obj/item/bikehorn, "trophy_message" = "henk") + var/list/start_showpieces = list() + /// A flavor message to show with this item. var/trophy_message = "" /obj/structure/displaycase/Initialize(mapload) @@ -46,18 +55,29 @@ /obj/structure/displaycase/examine(mob/user) . = ..() - if(alert) - . += "Hooked up with an anti-theft system." - if(emagged) - . += "The ID lock has been shorted out." if(showpiece) - . += "There's [showpiece] inside." + . += "There's \a [showpiece] displayed inside." + else + . += "It's empty." if(trophy_message) . += "The plaque reads:\n [trophy_message]" + if(!openable) + . += "It seems to be sealed shut, there's no way you're getting that open." + else + if(!open) + . += "The ID lock is active, you need to swipe an ID to open it." + else if((broken || open) && showpiece) + . += "[showpiece] is held in a loose low gravity suspension field. You can take [showpiece] out[broken ? "." : ", or lock [src] with an ID"]." -/obj/structure/displaycase/proc/dump() + if(alert) + . += "It is hooked up with an anti-theft system." + if(emagged) + . += "The ID lock has been shorted out." + +/obj/structure/displaycase/proc/dump(mob/user) if(showpiece) - showpiece.forceMove(loc) + if(!user || !user.put_in_hands(showpiece)) + showpiece.forceMove(loc) showpiece = null /obj/structure/displaycase/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) @@ -109,9 +129,15 @@ . += "glassbox_closed" /obj/structure/displaycase/attackby(obj/item/I, mob/user, params) - if(I.GetID() && !broken && openable) + if(I.GetID()) + if(!openable) + to_chat(user, "There is no ID scanner, looks like this one is sealed shut.") + return + if(broken) + to_chat(user, "[src] is broken, the ID lock won't do anything.") + return if(allowed(user) || emagged) - to_chat(user, "You [open ? "close":"open"] [src].") + to_chat(user, "You use [I] to [open ? "close" : "open"] [src].") toggle_lock() else to_chat(user, "Access denied.") @@ -181,17 +207,19 @@ user.changeNext_move(CLICK_CD_MELEE) if(showpiece && (broken || open)) to_chat(user, "You deactivate the hover field built into the case.") - dump() + dump(user) add_fingerprint(user) update_icon(UPDATE_OVERLAYS) return - else - //prevents remote "kicks" with TK - if(!Adjacent(user)) - return - user.visible_message("[user] kicks the display case.") - user.do_attack_animation(src, ATTACK_EFFECT_KICK) - take_damage(2) + if(!open && openable) + to_chat(user, "The ID lock is active, you'll need to unlock it first.") + return + //prevents remote "kicks" with TK + if(!Adjacent(user)) + return + user.visible_message("[user] kicks the display case.") + user.do_attack_animation(src, ATTACK_EFFECT_KICK) + take_damage(2) /obj/structure/displaycase_chassis anchored = TRUE @@ -205,9 +233,9 @@ /obj/structure/displaycase_chassis/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/airlock_electronics)) to_chat(user, "You start installing the electronics into [src]...") - playsound(loc, I.usesound, 50, 1) + playsound(loc, I.usesound, 50, TRUE) if(do_after(user, 30, target = src)) - var/obj/item/airlock_electronics/new_electronics = I + var/obj/item/airlock_electronics/new_electronics = I if(user.drop_item() && !new_electronics.is_installed) new_electronics.forceMove(src) electronics = new_electronics