/* 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 = 1 anchored = 1 /obj/structure/filingcabinet/chestdrawer name = "chest drawer" icon_state = "chestdrawer" /obj/structure/filingcabinet/chestdrawer/autopsy name = "autopsy reports drawer" desc = "A large drawer for holding autopsy reports." /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() ..() for(var/obj/item/I in loc) if(istype(I, /obj/item/paper) || istype(I, /obj/item/folder) || istype(I, /obj/item/photo)) I.loc = src /obj/structure/filingcabinet/attackby(obj/item/P as obj, mob/user as mob, params) if(istype(P, /obj/item/paper) || istype(P, /obj/item/folder) || istype(P, /obj/item/photo) || istype(P, /obj/item/paper_bundle) || istype(P, /obj/item/documents)) to_chat(user, "You put [P] in [src].") user.drop_item() P.loc = src icon_state = "[initial(icon_state)]-open" sleep(5) icon_state = initial(icon_state) updateUsrDialog() else if(istype(P, /obj/item/wrench)) playsound(loc, P.usesound, 50, 1) anchored = !anchored to_chat(user, "You [anchored ? "wrench" : "unwrench"] \the [src].") else if(user.a_intent != INTENT_HARM) to_chat(user, "You can't put [P] in [src]!") else return ..() /obj/structure/filingcabinet/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) new /obj/item/stack/sheet/metal(loc, 2) for(var/obj/item/I in src) I.forceMove(loc) qdel(src) /obj/structure/filingcabinet/attack_hand(mob/user as mob) if(contents.len <= 0) to_chat(user, "\The [src] is empty.") return user.set_machine(src) var/dat = "
" for(var/obj/item/P in src) dat += "" dat += "
[P.name]
" var/datum/browser/popup = new(user, "filingcabinet", name, 350, 300) popup.set_content(dat) popup.open(0) return /obj/structure/filingcabinet/attack_tk(mob/user) if(anchored) attack_self_tk(user) else ..() /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, "You pull \a [I] out of [src] at random.") return to_chat(user, "You find nothing in [src].") /obj/structure/filingcabinet/Topic(href, href_list) if(href_list["retrieve"]) usr << browse(null, "window=filingcabinet") // Close the menu //var/retrieveindex = text2num(href_list["retrieve"]) var/obj/item/P = locate(href_list["retrieve"])//contents[retrieveindex] if(istype(P) && (P.loc == src) && src.Adjacent(usr)) usr.put_in_hands(P) updateUsrDialog() icon_state = "[initial(icon_state)]-open" spawn(0) sleep(5) 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 = "
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
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
Comments/Log

" for(var/c in S.fields["comments"]) P.info += "[c]
" P.info += "" P.name = "paper - '[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 var/obj/item/paper/P = new /obj/item/paper(src) P.info = "
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
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
Comments/Log

" for(var/c in M.fields["comments"]) P.info += "[c]
" P.info += "" P.name = "paper - '[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() ..() /* * Employment contract Cabinets */ GLOBAL_LIST_EMPTY(employmentCabinets) /obj/structure/filingcabinet/employment var/cooldown = 0 icon_state = "employmentcabinet" var/virgin = 1 /obj/structure/filingcabinet/employment/New() GLOB.employmentCabinets += src return ..() /obj/structure/filingcabinet/employment/Destroy() GLOB.employmentCabinets -= src return ..() /obj/structure/filingcabinet/employment/proc/fillCurrent() //This proc fills the cabinet with the current crew. for(var/record in GLOB.data_core.locked) var/datum/data/record/G = record if(!G) continue if(G.fields["reference"]) addFile(G.fields["reference"]) /obj/structure/filingcabinet/employment/proc/addFile(mob/living/carbon/human/employee) new /obj/item/paper/contract/employment(src, employee) /obj/structure/filingcabinet/employment/attack_hand(mob/user) if(!cooldown) if(virgin) fillCurrent() virgin = 0 cooldown = 1 ..() sleep(100) // prevents the devil from just instantly emptying the cabinet, ensuring an easy win. cooldown = 0 else to_chat(user, "The [src] is jammed, give it a few seconds.") /obj/structure/filingcabinet/employment/attackby(obj/item/P, mob/user, params) if(istype(P, /obj/item/wrench)) to_chat(user, "You begin to [anchored ? "wrench" : "unwrench"] [src].") if (do_after(user,300,user)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) anchored = !anchored to_chat(user, "You successfully [anchored ? "wrench" : "unwrench"] [src].") else return ..()