/* Filing cabinets! * Contains: * Filing Cabinets * Security Record Cabinets * Medical Record 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/filingcabinet //not changing the path to avoid unecessary map issues, but please don't name stuff like this in the future -Pete icon_state = "tallcabinet" /obj/structure/filingcabinet/Initialize(mapload) for(var/obj/item/I in loc) if(istype(I, /obj/item/paper) || istype(I, /obj/item/folder) || istype(I, /obj/item/photo) || istype(I, /obj/item/paper_bundle)) I.loc = src . = ..() AddElement(/datum/element/climbable) /obj/structure/filingcabinet/attackby(obj/item/P as obj, mob/user as mob) if(istype(P, /obj/item/paper) || istype(P, /obj/item/folder) || istype(P, /obj/item/photo) || istype(P, /obj/item/paper_bundle)) to_chat(user, span_notice("You put [P] in [src].")) user.drop_item() P.loc = src open_animation() SStgui.update_uis(src) else if(P.has_tool_quality(TOOL_WRENCH)) playsound(src, P.usesound, 50, 1) anchored = !anchored to_chat(user, span_notice("You [anchored ? "wrench" : "unwrench"] \the [src].")) else if(P.has_tool_quality(TOOL_SCREWDRIVER)) to_chat(user, span_notice("You begin taking the [name] apart.")) playsound(src, P.usesound, 50, 1) if(do_after(user, 1 SECOND * P.toolspeed, target = src)) playsound(src, P.usesound, 50, 1) to_chat(user, span_notice("You take the [name] apart.")) new /obj/item/stack/material/steel( src.loc, 4 ) for(var/obj/item/I in contents) I.forceMove(loc) qdel(src) return else to_chat(user, span_notice("You can't put [P] in [src]!")) /obj/structure/filingcabinet/attack_hand(mob/user as mob) if(contents.len <= 0) to_chat(user, span_notice("\The [src] is empty.")) return tgui_interact(user) /obj/structure/filingcabinet/attack_tk(mob/user) if(anchored) return attack_self_tk(user) return ..() /obj/structure/filingcabinet/attack_self_tk(mob/user) if(contents.len) if(prob(40 + contents.len * 5)) var/obj/item/I = pick(contents) I.loc = 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/tgui_state(mob/user) return GLOB.tgui_physical_state /obj/structure/filingcabinet/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "FileCabinet", name) ui.set_autoupdate(FALSE) ui.open() /obj/structure/filingcabinet/tgui_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/tgui_act(action, params) . = ..() if(.) return switch(action) if("remove_object") var/obj/item/content = locate(params["ref"]) in src if(istype(content) && (content.loc == src) && usr.Adjacent(src)) usr.put_in_hands(content) open_animation() SStgui.update_uis(src) /obj/structure/filingcabinet/proc/open_animation() flick("[initial(icon_state)]-open",src) playsound(src, 'sound/bureaucracy/filingcabinet.ogg', 50, 1) spawn(0) sleep(20) icon_state = initial(icon_state) /* * Security Record Cabinets */ /obj/structure/filingcabinet/security var/virgin = 1 /obj/structure/filingcabinet/security/proc/populate() if(virgin) for(var/datum/data/record/G in GLOB.data_core.general) var/datum/data/record/S for(var/datum/data/record/R in GLOB.data_core.security) if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) S = R break var/obj/item/paper/P = new /obj/item/paper(src) P.info = "
" + span_bold("Security Record") + "

" P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nFingerprint: [G.fields["fingerprint"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" P.info += "
\n
" + span_bold("Security Data") + "

\nCriminal Status: [S.fields["criminal"]]
\n
\nMinor Crimes: [S.fields["mi_crim"]]
\nDetails: [S.fields["mi_crim_d"]]
\n
\nMajor Crimes: [S.fields["ma_crim"]]
\nDetails: [S.fields["ma_crim_d"]]
\n
\nImportant Notes:
\n\t[S.fields["notes"]]
\n
\n
" + span_bold("Comments/Log") + "

" var/counter = 1 while(S.fields["com_[counter]"]) P.info += "[S.fields["com_[counter]"]]
" counter++ P.info += "" P.name = "Security Record ([G.fields["name"]])" virgin = 0 //tabbing here is correct- it's possible for people to try and use it //before the records have been generated, so we do this inside the loop. /obj/structure/filingcabinet/security/attack_hand() populate() ..() /obj/structure/filingcabinet/security/attack_tk() populate() ..() /* * Medical Record Cabinets */ /obj/structure/filingcabinet/medical var/virgin = 1 /obj/structure/filingcabinet/medical/proc/populate() if(virgin) for(var/datum/data/record/G in GLOB.data_core.general) var/datum/data/record/M for(var/datum/data/record/R in GLOB.data_core.medical) if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) M = R break if(M) var/obj/item/paper/P = new /obj/item/paper(src) P.info = "
" + span_bold("Medical Record") + "

" P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nFingerprint: [G.fields["fingerprint"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" P.info += "
\n
" + span_bold("Medical Data") + "

\nBlood Type: [M.fields["b_type"]]
\nDNA: [M.fields["b_dna"]]
\n
\nMinor Disabilities: [M.fields["mi_dis"]]
\nDetails: [M.fields["mi_dis_d"]]
\n
\nMajor Disabilities: [M.fields["ma_dis"]]
\nDetails: [M.fields["ma_dis_d"]]
\n
\nAllergies: [M.fields["alg"]]
\nDetails: [M.fields["alg_d"]]
\n
\nCurrent Diseases: [M.fields["cdi"]] (per disease info placed in log/comment section)
\nDetails: [M.fields["cdi_d"]]
\n
\nImportant Notes:
\n\t[M.fields["notes"]]
\n
\n
" + span_bold("Comments/Log") + "

" var/counter = 1 while(M.fields["com_[counter]"]) P.info += "[M.fields["com_[counter]"]]
" counter++ P.info += "" P.name = "Medical Record ([G.fields["name"]])" virgin = 0 //tabbing here is correct- it's possible for people to try and use it //before the records have been generated, so we do this inside the loop. /obj/structure/filingcabinet/medical/attack_hand() populate() ..() /obj/structure/filingcabinet/medical/attack_tk() populate() ..()