From ae61572d0b9adb71eb1c49a108e277ca5ef6092e Mon Sep 17 00:00:00 2001 From: Mervill Date: Thu, 15 Dec 2016 14:08:20 -0800 Subject: [PATCH] Notice boards can now have images pinned to them (#22152) * Notice boards can use authorization * stock notice boards for the heads of staff * Title of the UI uses the notice board's name * Add notice boards for heads of staff to boxstation * formatting oversight * noticeboards use proper examinate behaviour for paper * You can now put images on the noticeboard * Made interacting with the noticeboard not annoying * Revert "Add notice boards for heads of staff to boxstation" This reverts commit 56a30da0957ac3679bcd84744d54c526543802c1. * code review * properly restrict locate() --- code/game/objects/structures/noticeboard.dm | 95 +++++++++++++++------ 1 file changed, 67 insertions(+), 28 deletions(-) diff --git a/code/game/objects/structures/noticeboard.dm b/code/game/objects/structures/noticeboard.dm index c58b11f2186..f84f61b7990 100644 --- a/code/game/objects/structures/noticeboard.dm +++ b/code/game/objects/structures/noticeboard.dm @@ -19,67 +19,106 @@ //attaching papers!! /obj/structure/noticeboard/attackby(obj/item/weapon/O, mob/user, params) - if(istype(O, /obj/item/weapon/paper)) + if(istype(O, /obj/item/weapon/paper) || istype(O, /obj/item/weapon/photo)) + if(!allowed(user)) + user << "You are not authorized to add notices" + return if(notices < 5) - if(!user.drop_item()) + if(!user.unEquip(O)) return - O.add_fingerprint(user) - add_fingerprint(user) O.loc = src notices++ - icon_state = "nboard0[notices]" //update sprite - user << "You pin the paper to the noticeboard." + icon_state = "nboard0[notices]" + user << "You pin the [O] to the noticeboard." else - user << "You reach to pin your paper to the board but hesitate. You are certain your paper will not be seen among the many others already attached." + user << "The notice board is full" else return ..() /obj/structure/noticeboard/attack_hand(mob/user) - var/dat = "Noticeboard
" - for(var/obj/item/weapon/paper/P in src) - dat += "[P.name] Write Remove
" + var/auth = allowed(user) + var/dat = "[name]
" + for(var/obj/item/P in src) + if(istype(P, /obj/item/weapon/paper)) + dat += "[P.name] [auth ? "Write Remove" : ""]
" + else + dat += "[P.name] [auth ? "Remove" : ""]
" user << browse("Notices[dat]","window=noticeboard") onclose(user, "noticeboard") - /obj/structure/noticeboard/Topic(href, href_list) ..() usr.set_machine(src) if(href_list["remove"]) if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open return - var/obj/item/P = locate(href_list["remove"]) - if((P && P.loc == src)) - P.loc = get_turf(src) //dump paper on the floor because you're a clumsy fuck - P.add_fingerprint(usr) - add_fingerprint(usr) + var/obj/item/I = locate(href_list["remove"]) in contents + if(istype(I) && I.loc == src) + I.loc = usr.loc + usr.put_in_hands(I) notices-- icon_state = "nboard0[notices]" if(href_list["write"]) if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open return - var/obj/item/P = locate(href_list["write"]) - - if((P && P.loc == src)) //ifthe paper's on the board + var/obj/item/P = locate(href_list["write"]) in contents + if(istype(P) && P.loc == src) var/obj/item/I = usr.is_holding_item_of_type(/obj/item/weapon/pen) - if(I) //check hand for pen + if(I) add_fingerprint(usr) P.attackby(I, usr) else usr << "You'll need something to write with!" if(href_list["read"]) - var/obj/item/weapon/paper/P = locate(href_list["read"]) - if((P && P.loc == src)) - if(!ishuman(usr)) - usr << browse("[P.name][stars(P.info)]", "window=[P.name]") - onclose(usr, "[P.name]") - else - usr << browse("[P.name][P.info]", "window=[P.name]") - onclose(usr, "[P.name]") + var/obj/item/I = locate(href_list["read"]) in contents + if(istype(I) && I.loc == src) + usr.examinate(I) /obj/structure/noticeboard/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) new /obj/item/stack/sheet/metal (loc, 1) qdel(src) + +// Notice boards for the heads of staff (plus the qm) + +/obj/structure/noticeboard/captain + name = "Captain's Notice Board" + desc = "Important notices from the Captain" + req_access = list(access_captain) + +/obj/structure/noticeboard/hop + name = "Head of Personel's Notice Board" + desc = "Important notices from the Head of Personel" + req_access = list(access_hop) + +/obj/structure/noticeboard/ce + name = "Chief Engineer's Notice Board" + desc = "Important notices from the Chief Engineer" + req_access = list(access_ce) + +/obj/structure/noticeboard/hos + name = "Head of Security's Notice Board" + desc = "Important notices from the Head of Security" + req_access = list(access_hos) + +/obj/structure/noticeboard/cmo + name = "Chief Medical Officer's Notice Board" + desc = "Important notices from the Chief Medical Officer" + req_access = list(access_cmo) + +/obj/structure/noticeboard/rd + name = "Research Director's Notice Board" + desc = "Important notices from the Research Director" + req_access = list(access_rd) + +/obj/structure/noticeboard/qm + name = "Quartermaster's Notice Board" + desc = "Important notices from the Quartermaster" + req_access = list(access_qm) + +/obj/structure/noticeboard/staff + name = "Staff Notice Board" + desc = "Important notices from the heads of staff" + req_access = list(access_heads)