/* Filing cabinets! * Contains: * Filing Cabinets * Security Record Cabinets * Medical Record Cabinets * Employment Contract Cabinets */ /* * Filing Cabinets */ /obj/structure/filingcabinet name = "filing cabinet" desc = "A large cabinet with drawers." icon = 'icons/obj/bureaucracy.dmi' icon_state = "filingcabinet" density = TRUE anchored = TRUE /obj/structure/filingcabinet/chestdrawer name = "chest drawer" icon_state = "chestdrawer" /obj/structure/filingcabinet/chestdrawer/wheeled name = "rolling chest drawer" desc = "A small cabinet with drawers. This one has wheels!" anchored = FALSE /obj/structure/filingcabinet/filingcabinet //not changing the path to avoid unnecessary map issues, but please don't name stuff like this in the future -Pete icon_state = "tallcabinet" /obj/structure/filingcabinet/Initialize(mapload) . = ..() if(mapload) for(var/obj/item/I in loc) if(I.w_class < WEIGHT_CLASS_NORMAL) //there probably shouldn't be anything placed ontop of filing cabinets in a map that isn't meant to go in them I.forceMove(src) /obj/structure/filingcabinet/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) new /obj/item/stack/sheet/iron(loc, 2) for(var/obj/item/I in src) I.forceMove(loc) qdel(src) /obj/structure/filingcabinet/attackby(obj/item/P, mob/living/user, params) var/list/modifiers = params2list(params) if(P.tool_behaviour == TOOL_WRENCH && LAZYACCESS(modifiers, RIGHT_CLICK)) to_chat(user, span_notice("You begin to [anchored ? "unwrench" : "wrench"] [src].")) if(P.use_tool(src, user, 20, volume=50)) to_chat(user, span_notice("You successfully [anchored ? "unwrench" : "wrench"] [src].")) set_anchored(!anchored) else if(P.w_class < WEIGHT_CLASS_NORMAL) if(!user.transferItemToLoc(P, src)) return to_chat(user, span_notice("You put [P] in [src].")) icon_state = "[initial(icon_state)]-open" sleep(5) icon_state = initial(icon_state) updateUsrDialog() else if(!user.combat_mode) to_chat(user, span_warning("You can't put [P] in [src]!")) else return ..() /obj/structure/filingcabinet/attack_hand(mob/living/carbon/user, list/modifiers) . = ..() ui_interact(user) /obj/structure/filingcabinet/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "FilingCabinet") ui.open() /obj/structure/filingcabinet/ui_data(mob/user) var/list/data = list() data["cabinet_name"] = "[name]" data["contents"] = list() data["contents_ref"] = list() for(var/obj/item/content in src) data["contents"] += "[content]" data["contents_ref"] += "[REF(content)]" return data /obj/structure/filingcabinet/ui_act(action, params) . = ..() if(.) return switch(action) // Take the object out if("remove_object") var/obj/item/content = locate(params["ref"]) in src if(istype(content) && in_range(src, usr)) usr.put_in_hands(content) updateUsrDialog() icon_state = "[initial(icon_state)]-open" addtimer(VARSET_CALLBACK(src, icon_state, initial(icon_state)), 5) /obj/structure/filingcabinet/attack_tk(mob/user) if(anchored) return attack_self_tk(user) return ..() /obj/structure/filingcabinet/attack_self_tk(mob/user) . = COMPONENT_CANCEL_ATTACK_CHAIN if(contents.len) if(prob(40 + contents.len * 5)) var/obj/item/I = pick(contents) I.forceMove(loc) if(prob(25)) step_rand(I) to_chat(user, span_notice("You pull \a [I] out of [src] at random.")) return to_chat(user, span_notice("You find nothing in [src].")) /obj/structure/filingcabinet/Topic(href, href_list) if(!usr.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(usr))) return if(href_list["retrieve"]) usr << browse("", "window=filingcabinet") // Close the menu var/obj/item/P = locate(href_list["retrieve"]) in src //contents[retrieveindex] if(istype(P) && in_range(src, usr)) usr.put_in_hands(P) updateUsrDialog() icon_state = "[initial(icon_state)]-open" addtimer(VARSET_CALLBACK(src, icon_state, initial(icon_state)), 5) /* * Security Record Cabinets */ /obj/structure/filingcabinet/security var/virgin = TRUE /obj/structure/filingcabinet/security/proc/populate() if(virgin) for(var/datum/data/record/G in GLOB.data_core.general) var/datum/data/record/S = find_record("name", G.fields["name"], GLOB.data_core.security) if(!S) continue var/obj/item/paper/P = new /obj/item/paper(src) P.info = "