frontend
This commit is contained in:
@@ -52,6 +52,8 @@
|
||||
var/author_ckey
|
||||
var/icon_generated = FALSE
|
||||
var/icon/generated_icon
|
||||
///boolean that blocks persistence from saving it. enabled from printing copies, because we do not want to save copies.
|
||||
var/no_save = FALSE
|
||||
|
||||
// Painting overlay offset when framed
|
||||
var/framed_offset_x = 11
|
||||
@@ -370,7 +372,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/structure/sign/painting/proc/save_persistent()
|
||||
if(!persistence_id || !current_canvas)
|
||||
if(!persistence_id || !current_canvas || current_canvas.no_save)
|
||||
return
|
||||
if(sanitize_filename(persistence_id) != persistence_id)
|
||||
stack_trace("Invalid persistence_id - [persistence_id]")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#define MAX_NOTICES 5
|
||||
|
||||
/obj/structure/noticeboard
|
||||
name = "notice board"
|
||||
desc = "A board for pinning important notices upon."
|
||||
@@ -7,8 +9,25 @@
|
||||
density = FALSE
|
||||
anchored = TRUE
|
||||
max_integrity = 150
|
||||
/// Current number of a pinned notices
|
||||
var/notices = 0
|
||||
|
||||
/obj/structure/noticeboard/directional/north
|
||||
dir = SOUTH
|
||||
pixel_y = 32
|
||||
|
||||
/obj/structure/noticeboard/directional/south
|
||||
dir = NORTH
|
||||
pixel_y = -32
|
||||
|
||||
/obj/structure/noticeboard/directional/east
|
||||
dir = WEST
|
||||
pixel_x = 32
|
||||
|
||||
/obj/structure/noticeboard/directional/west
|
||||
dir = EAST
|
||||
pixel_x = -32
|
||||
|
||||
/obj/structure/noticeboard/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
@@ -16,7 +35,7 @@
|
||||
return
|
||||
|
||||
for(var/obj/item/I in loc)
|
||||
if(notices > 4)
|
||||
if(notices >= MAX_NOTICES)
|
||||
break
|
||||
if(istype(I, /obj/item/paper))
|
||||
I.forceMove(src)
|
||||
@@ -27,67 +46,84 @@
|
||||
/obj/structure/noticeboard/attackby(obj/item/O, mob/user, params)
|
||||
if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo))
|
||||
if(!allowed(user))
|
||||
to_chat(user, "<span class='info'>You are not authorized to add notices</span>")
|
||||
to_chat(user, span_warning("You are not authorized to add notices!"))
|
||||
return
|
||||
if(notices < 5)
|
||||
if(notices < MAX_NOTICES)
|
||||
if(!user.transferItemToLoc(O, src))
|
||||
return
|
||||
notices++
|
||||
icon_state = "nboard0[notices]"
|
||||
to_chat(user, "<span class='notice'>You pin the [O] to the noticeboard.</span>")
|
||||
to_chat(user, span_notice("You pin the [O] to the noticeboard."))
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The notice board is full</span>")
|
||||
to_chat(user, span_warning("The notice board is full!"))
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/noticeboard/interact(mob/user)
|
||||
ui_interact(user)
|
||||
/obj/structure/noticeboard/ui_state(mob/user)
|
||||
return GLOB.physical_state
|
||||
|
||||
/obj/structure/noticeboard/ui_interact(mob/user)
|
||||
/obj/structure/noticeboard/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "NoticeBoard", name)
|
||||
ui.open()
|
||||
|
||||
/obj/structure/noticeboard/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["allowed"] = allowed(user)
|
||||
data["items"] = list()
|
||||
for(var/obj/item/content in contents)
|
||||
var/list/content_data = list(
|
||||
name = content.name,
|
||||
ref = REF(content)
|
||||
)
|
||||
data["items"] += list(content_data)
|
||||
return data
|
||||
|
||||
/obj/structure/noticeboard/ui_act(action, params)
|
||||
. = ..()
|
||||
var/auth = allowed(user)
|
||||
var/dat = "<B>[name]</B><BR>"
|
||||
for(var/obj/item/P in src)
|
||||
if(istype(P, /obj/item/paper))
|
||||
dat += "<A href='?src=[REF(src)];read=[REF(P)]'>[P.name]</A> [auth ? "<A href='?src=[REF(src)];write=[REF(P)]'>Write</A> <A href='?src=[REF(src)];remove=[REF(P)]'>Remove</A>" : ""]<BR>"
|
||||
else
|
||||
dat += "<A href='?src=[REF(src)];read=[REF(P)]'>[P.name]</A> [auth ? "<A href='?src=[REF(src)];remove=[REF(P)]'>Remove</A>" : ""]<BR>"
|
||||
user << browse("<HEAD><TITLE>Notices</TITLE></HEAD>[dat]","window=noticeboard")
|
||||
onclose(user, "noticeboard")
|
||||
if(.)
|
||||
return
|
||||
|
||||
/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/I = locate(href_list["remove"]) in contents
|
||||
if(istype(I) && I.loc == src)
|
||||
I.forceMove(usr.loc)
|
||||
usr.put_in_hands(I)
|
||||
notices--
|
||||
icon_state = "nboard0[notices]"
|
||||
var/obj/item/item = locate(params["ref"]) in contents
|
||||
if(!istype(item) || item.loc != src)
|
||||
return
|
||||
|
||||
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"]) in contents
|
||||
if(istype(P) && P.loc == src)
|
||||
var/obj/item/I = usr.is_holding_item_of_type(/obj/item/pen)
|
||||
if(I)
|
||||
add_fingerprint(usr)
|
||||
P.attackby(I, usr)
|
||||
var/mob/user = usr
|
||||
|
||||
switch(action)
|
||||
if("examine")
|
||||
if(istype(item, /obj/item/paper))
|
||||
item.ui_interact(user)
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>You'll need something to write with!</span>")
|
||||
user.examinate(item)
|
||||
return TRUE
|
||||
if("remove")
|
||||
if(!allowed(user))
|
||||
return
|
||||
remove_item(item, user)
|
||||
return TRUE
|
||||
|
||||
if(href_list["read"])
|
||||
var/obj/item/I = locate(href_list["read"]) in contents
|
||||
if(istype(I) && I.loc == src)
|
||||
usr.examinate(I)
|
||||
/**
|
||||
* Removes an item from the notice board
|
||||
*
|
||||
* Arguments:
|
||||
* * item - The item that is to be removed
|
||||
* * user - The mob that is trying to get the item removed, if there is one
|
||||
*/
|
||||
/obj/structure/noticeboard/proc/remove_item(obj/item/item, mob/user)
|
||||
item.forceMove(drop_location())
|
||||
if(user)
|
||||
user.put_in_hands(item)
|
||||
balloon_alert(user, "removed from board")
|
||||
notices--
|
||||
icon_state = "nboard0[notices]"
|
||||
|
||||
/obj/structure/noticeboard/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
new /obj/item/stack/sheet/metal (loc, 1)
|
||||
new /obj/item/stack/sheet/iron (loc, 1)
|
||||
for(var/obj/item/content in contents)
|
||||
remove_item(content)
|
||||
qdel(src)
|
||||
|
||||
// Notice boards for the heads of staff (plus the qm)
|
||||
@@ -131,3 +167,5 @@
|
||||
name = "Staff Notice Board"
|
||||
desc = "Important notices from the heads of staff."
|
||||
req_access = list(ACCESS_HEADS)
|
||||
|
||||
#undef MAX_NOTICES
|
||||
|
||||
Reference in New Issue
Block a user