/* 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
maxhealth = OBJECT_HEALTH_VERY_LOW
armor = list(MELEE = ARMOR_MELEE_SMALL, BULLET = ARMOR_BALLISTIC_MINOR)
var/static/list/accepted_items = list(
/obj/item/paper,
/obj/item/folder,
/obj/item/photo,
/obj/item/paper_bundle,
/obj/item/sample,
/obj/item/book,
/obj/item/card,
/obj/item/forensics/slide,
/obj/item/forensics/swab,
/obj/item/storage/photo_album,
/obj/item/clipboard,
/obj/item/disk,
/obj/item/pen,
/obj/item/clothing/accessory/badge,
/obj/item/pack,
/obj/item/hand,
/obj/item/key,
/obj/item/paper_scanner
)
/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()
. = ..()
for(var/obj/item/I in loc)
if(is_type_in_list(I, accepted_items))
I.forceMove(src)
/obj/structure/filingcabinet/attackby(obj/item/attacking_item, mob/user)
if(is_type_in_list(attacking_item, accepted_items))
to_chat(user, SPAN_NOTICE("You put [attacking_item] in [src]."))
user.drop_from_inventory(attacking_item, src)
flick("[initial(icon_state)]-open", src)
playsound(loc, 'sound/items/bureaucracy/filingcabinet.ogg', 50, 1)
sleep(40)
icon_state = initial(icon_state)
updateUsrDialog()
else if(attacking_item.tool_behaviour == TOOL_WRENCH)
attacking_item.play_tool_sound(get_turf(src), 50)
anchored = !anchored
to_chat(user, SPAN_NOTICE("You [anchored ? "wrench" : "unwrench"] \the [src]."))
else
to_chat(user, SPAN_NOTICE("You can't put [attacking_item] in [src]!"))
/obj/structure/filingcabinet/on_death(damage, damage_flags, damage_type, armor_penetration, obj/weapon)
for(var/obj/item/thing in src)
if(prob(25))
if(istype(thing, /obj/item/paper))
if(prob(50))
var/obj/item/paper/paper = thing
paper.crumple()
thing.forceMove(get_turf(src))
. = ..()
/obj/structure/filingcabinet/attack_hand(mob/user as mob)
if(contents.len <= 0)
to_chat(user, SPAN_NOTICE("\The [src] is empty."))
return
user.set_machine(src)
var/dat = "
"
for(var/obj/item/P in src)
dat += "| [P.name] |
"
dat += "
"
user << browse("[name][dat]", "window=filingcabinet;size=350x300")
/obj/structure/filingcabinet/Topic(href, href_list)
if(href_list["retrieve"])
usr << browse("", "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()
flick("[initial(icon_state)]-open",src)
playsound(loc, 'sound/items/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/record/general/R in SSrecords.records)
if(istype(R) && istype(R.security))
var/obj/item/paper/P = new /obj/item/paper(src)
P.info = "Security Record
"
P.info += {"
Name: [R.name] ID: [R.id]
Sex: [R.sex]
Age: [R.age]
Fingerprint: [R.fingerprint]
Physical Status: [R.physical_status]
Mental Status: [R.mental_status]
Security Data
Criminal Status: [R.security.criminal]
Crimes: [R.security.crimes]
Important Notes:
\t[replacetext(R.security.notes, "\n", "
")]
\n
Comments/Log
"}
for(var/comment in R.security.comments)
P.info += "[comment]
"
P.info += ""
P.name = "Security Record ([R.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/do_simple_ranged_interaction(var/mob/user)
populate()
..()
/*
* Medical Record Cabinets
*/
/obj/structure/filingcabinet/medical
var/virgin = 1
/obj/structure/filingcabinet/medical/proc/populate()
if(virgin)
for(var/datum/record/general/R in SSrecords.records)
if(istype(R) && istype(R.medical))
var/obj/item/paper/P = new /obj/item/paper(src)
var/info = "Medical Record
"
info += {"
Name: [R.name] ID: [R.id]
Sex: [R.sex]
Age: [R.age]
Fingerprint: [R.fingerprint]
Physical Status: [R.physical_status]
Mental Status: [R.mental_status]
Medical Data
Blood Type: [R.medical.blood_type]
DNA: [R.medical.blood_dna]
Important Notes:
[replacetext(R.medical.notes, "\n", "
")]
Comments/Log
"}
for(var/comment in R.medical.comments)
info += "[comment]
"
info += ""
var/pname = "Medical Record ([R.name])"
P.set_content_unsafe(pname, info)
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/do_simple_ranged_interaction(var/mob/user)
populate()
..()