From 27ff0a4f28c12aa97c5f9f7d806f3fc984016860 Mon Sep 17 00:00:00 2001 From: Dax Dupont Date: Fri, 9 Mar 2018 09:17:57 +0100 Subject: [PATCH] Display cases can now have a list where to randomly spawn items from (#36058) * Adds allowing display cases to pick from a random list Keeps compatibility with older maps and moves trophy/plaque message to all display cases * A bit more legible * Refactors statues tool interaction code * Don't override it already exists * done --- code/controllers/subsystem/persistence.dm | 2 + code/game/objects/structures/displaycase.dm | 22 ++++---- code/game/objects/structures/statues.dm | 57 +++++---------------- 3 files changed, 28 insertions(+), 53 deletions(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 0500de33b6..791a334b55 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -171,6 +171,8 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items) for(var/A in GLOB.trophy_cases) var/obj/structure/displaycase/trophy/T = A + if (T.showpiece) + continue T.added_roundstart = TRUE var/trophy_data = pick_n_take(trophy_items) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 94e6d62747..ed5eb2cce9 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -15,9 +15,17 @@ var/openable = TRUE var/obj/item/electronics/airlock/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") + var/trophy_message = "" /obj/structure/displaycase/Initialize() . = ..() + if(start_showpieces.len && !start_showpiece_type) + var/list/showpiece_entry = pick(start_showpieces) + if (showpiece_entry && showpiece_entry["type"]) + start_showpiece_type = showpiece_entry["type"] + if (showpiece_entry["trophy_message"]) + trophy_message = showpiece_entry["trophy_message"] if(start_showpiece_type) showpiece = new start_showpiece_type (src) update_icon() @@ -35,6 +43,9 @@ to_chat(user, "Hooked up with an anti-theft system.") if(showpiece) to_chat(user, "There's [showpiece] inside.") + if(trophy_message) + to_chat(user, "The plaque reads:") + to_chat(user, trophy_message) /obj/structure/displaycase/proc/dump() @@ -213,7 +224,7 @@ //The captains display case requiring specops ID access is intentional. //The lab cage and captains display case do not spawn with electronics, which is why req_access is needed. /obj/structure/displaycase/captain - alert = 1 + alert = TRUE start_showpiece_type = /obj/item/gun/energy/laser/captain req_access = list(ACCESS_CENT_SPECOPS) @@ -223,12 +234,9 @@ start_showpiece_type = /obj/item/clothing/mask/facehugger/lamarr req_access = list(ACCESS_RD) - - /obj/structure/displaycase/trophy name = "trophy display case" desc = "Store your trophies of accomplishment in here, and they will stay forever." - var/trophy_message = "" var/placer_key = "" var/added_roundstart = TRUE var/is_locked = TRUE @@ -245,12 +253,6 @@ GLOB.trophy_cases -= src return ..() -/obj/structure/displaycase/trophy/examine(mob/user) - ..() - if(trophy_message) - to_chat(user, "The plaque reads:") - to_chat(user, trophy_message) - /obj/structure/displaycase/trophy/attackby(obj/item/W, mob/user, params) if(!user.Adjacent(src)) //no TK museology diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index 9aebbd955b..e5ab4e5776 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -1,6 +1,3 @@ - - - /obj/structure/statue name = "statue" desc = "Placeholder. Yell at Firecage if you SOMEHOW see this." @@ -16,47 +13,21 @@ /obj/structure/statue/attackby(obj/item/W, mob/living/user, params) add_fingerprint(user) user.changeNext_move(CLICK_CD_MELEE) - if(istype(W, /obj/item/wrench)) - if(anchored) - user.visible_message("[user] is loosening the [name]'s bolts.", \ - "You are loosening the [name]'s bolts...") - if(W.use_tool(src, user, 40, volume=100)) - if(!anchored) - return - user.visible_message("[user] loosened the [name]'s bolts!", \ - "You loosen the [name]'s bolts!") - anchored = FALSE - else - if(!isfloorturf(src.loc)) - user.visible_message("A floor must be present to secure the [name]!") - return - user.visible_message("[user] is securing the [name]'s bolts...", \ - "You are securing the [name]'s bolts...") - if(W.use_tool(src, user, 40, volume=100)) - if(anchored) - return - user.visible_message("[user] has secured the [name]'s bolts.", \ - "You have secured the [name]'s bolts.") - anchored = TRUE + if(!(flags_1 & NODECONSTRUCT_1)) + if(default_unfasten_wrench(user, W)) + return + if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter)) + if(!W.tool_start_check(user, amount=0)) + return FALSE - else if(istype(W, /obj/item/pickaxe/drill/jackhammer)) - user.visible_message("[user] destroys the [name]!", - "You destroy the [name].") - W.play_tool_sound(src) - qdel(src) - - else if(istype(W, /obj/item/weldingtool) || istype(W, /obj/item/gun/energy/plasmacutter)) - if(!W.tool_start_check(user, amount=0)) - return FALSE - - user.visible_message("[user] is slicing apart the [name].", \ - "You are slicing apart the [name]...") - if(W.use_tool(src, user, 40, volume=50)) - user.visible_message("[user] slices apart the [name].", \ - "You slice apart the [name]!") - deconstruct(TRUE) - else - return ..() + user.visible_message("[user] is slicing apart the [name].", \ + "You are slicing apart the [name]...") + if(W.use_tool(src, user, 40, volume=50)) + user.visible_message("[user] slices apart the [name].", \ + "You slice apart the [name]!") + deconstruct(TRUE) + return + return ..() /obj/structure/statue/attack_hand(mob/living/user) user.changeNext_move(CLICK_CD_MELEE)