GLOBAL_VAR(station_report) // Variable to save the station report #define PAPERWORK 1 #define PHOTO 2 /obj/item/clipboard name = "clipboard" desc = "It looks like you're writing a letter. Want some help?" icon = 'icons/obj/bureaucracy.dmi' icon_state = "clipboard" inhand_icon_state = "clipboard" w_class = WEIGHT_CLASS_SMALL throw_speed = 3 var/obj/item/pen/containedpen var/obj/item/toppaper slot_flags = ITEM_SLOT_BELT resistance_flags = FLAMMABLE new_attack_chain = TRUE /obj/item/clipboard/Initialize(mapload) . = ..() update_icon() /obj/item/clipboard/AltClick(mob/user) if(in_range(user, src) && !user.incapacitated()) if(is_pen(user.get_active_hand())) penPlacement(user, user.get_active_hand(), TRUE) else removePen(user) return . = ..() /obj/item/clipboard/proc/removePen(mob/user) if(!ishuman(user) || user.incapacitated()) return penPlacement(user, containedpen, FALSE) /obj/item/clipboard/proc/isPaperwork(obj/item/W) //This could probably do with being somewhere else but for now it's fine here. if(istype(W, /obj/item/paper) || istype(W, /obj/item/paper_bundle)) return PAPERWORK if(istype(W, /obj/item/photo)) return PHOTO /obj/item/clipboard/examine(mob/user) . = ..() . += SPAN_NOTICE("Alt-Click to remove its pen.") if(in_range(user, src) && toppaper) . += toppaper.examine(user) /obj/item/clipboard/proc/penPlacement(mob/user, obj/item/pen/P, placing) if(placing) if(containedpen) to_chat(user, SPAN_WARNING("There's already a pen in [src]!")) return if(!is_pen(P)) return to_chat(user, SPAN_NOTICE("You slide [P] into [src].")) user.transfer_item_to(P, src) containedpen = P add_fingerprint(user) else if(!containedpen) to_chat(user, SPAN_WARNING("There isn't a pen in [src] for you to remove!")) return to_chat(user, SPAN_NOTICE("You remove [containedpen] from [src].")) user.put_in_hands(containedpen) containedpen = null add_fingerprint(user) update_icon() /obj/item/clipboard/proc/showClipboard(mob/user) //Show them what's on the clipboard var/dat = "[src]" dat += "[containedpen ? "Remove pen" : "Add pen"]

" if(toppaper) dat += "Remove[toppaper.name]

" for(var/obj/item/P in src) if(isPaperwork(P) == PAPERWORK && P != toppaper) dat += "RemovePut on top[P.name]
" if(isPaperwork(P) == PHOTO) dat += "Remove[P.name]
" var/datum/browser/popup = new(user, "clipboard", "[src]", 400, 400) popup.set_content(dat) popup.open() /obj/item/clipboard/update_overlays() . = ..() if(toppaper) . += toppaper.icon_state . += toppaper.overlays if(containedpen) . += "clipboard_pen" for(var/obj/O in src) if(istype(O, /obj/item/photo)) var/image/img = image('icons/obj/bureaucracy.dmi') var/obj/item/photo/Ph = O img = Ph.tiny . += img break . += "clipboard_over" /obj/item/clipboard/item_interaction(mob/user, obj/item/used, list/modifiers) if(isPaperwork(used)) //If it's a photo, paper bundle, or piece of paper, place it on the clipboard. user.unequip(used) used.forceMove(src) to_chat(user, SPAN_NOTICE("You clip [used] onto [src].")) playsound(loc, "pageturn", 50, 1) if(isPaperwork(used) == PAPERWORK) toppaper = used update_icon() add_fingerprint(user) return ITEM_INTERACT_COMPLETE if(is_pen(used)) if(!toppaper) //If there's no paper we can write on, just stick the pen into the clipboard penPlacement(user, used, TRUE) return ITEM_INTERACT_COMPLETE toppaper.item_interaction(user, used, modifiers) add_fingerprint(user) return ITEM_INTERACT_COMPLETE if(istype(used, /obj/item/stamp) && toppaper) // We can stamp the topmost piece of paper. toppaper.item_interaction(user, used, modifiers) update_icon() add_fingerprint(user) return ITEM_INTERACT_COMPLETE return ..() /obj/item/clipboard/activate_self(mob/user) if(!user) return ..() showClipboard(user) add_fingerprint(user) return ITEM_INTERACT_COMPLETE /obj/item/clipboard/Topic(href, href_list) ..() if(!Adjacent(usr) || usr.incapacitated()) return var/obj/item/I = usr.get_active_hand() if(href_list["doPenThings"]) if(href_list["doPenThings"] == "Add") penPlacement(usr, I, TRUE) else penPlacement(usr, containedpen, FALSE) else if(href_list["remove"]) var/obj/item/P = locate(href_list["remove"]) in src if(isPaperwork(P)) usr.put_in_hands(P) to_chat(usr, SPAN_NOTICE("You remove [P] from [src].")) toppaper = locate(/obj/item/paper) in src if(!toppaper) //In case there's no paper, try find a paper bundle instead toppaper = locate(/obj/item/paper_bundle) in src else if(href_list["viewOrWrite"]) var/obj/item/P = locate(href_list["viewOrWrite"]) in src if(!isPaperwork(P)) return if(is_pen(I) && isPaperwork(P) != PHOTO) //Because you can't write on photos that aren't in your hand P.item_interaction(usr, I) else if(isPaperwork(P) == PAPERWORK) //Why can't these be subtypes of paper P.examine(usr) else if(isPaperwork(P) == PHOTO) var/obj/item/photo/Ph = P Ph.show(usr) else if(href_list["topPaper"]) var/obj/item/P = locate(href_list["topPaper"]) in src if(P == toppaper) return to_chat(usr, SPAN_NOTICE("You flick the pages so that [P] is on top.")) playsound(loc, "pageturn", 50, 1) toppaper = P update_icon() showClipboard(usr) /obj/item/clipboard/station_report name = "station report clipboard" desc = "An important clipboard used to make reports on the station status, deliverable to Nanotrasen at the end of the shift. The top paper is the one formally inspected." icon_state = "clipboard_premium" /obj/item/clipboard/station_report/Initialize(mapload) . = ..() GLOB.station_report = src var/start_paper = new /obj/item/paper(src) toppaper = start_paper update_icon() #undef PAPERWORK #undef PHOTO