Skip to content

Commit

Permalink
General tweaks to Bureaucracy items (ParadiseSS13#18401)
Browse files Browse the repository at this point in the history
* Clipboards, photos, papers, Oh my!

* clipboard menu begone

* good sound

* addressing sirryan

* fixesss

* desc overwrite sucks, goodbye

* addresses, fixes things

* aaa its broken

* i spent 3.5 hours debugging this

* null that

* ignore that im stupid

* sanity checks added

* okay guess that will never work again

* Sirryan Review

* sirryan review

* AA review
  • Loading branch information
Contrabang authored Aug 9, 2022
1 parent 35221c0 commit b218813
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 63 deletions.
28 changes: 17 additions & 11 deletions code/modules/paperwork/clipboard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
..()
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/verb/removePen(mob/user)
set category = "Object"
set name = "Remove clipboard pen"
Expand Down Expand Up @@ -77,6 +86,13 @@
. += 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/attackby(obj/item/W, mob/user)
Expand All @@ -92,19 +108,9 @@
if(!toppaper) //If there's no paper we can write on, just stick the pen into the clipboard
penPlacement(user, W, TRUE)
return
if(containedpen) //If there's a pen in the clipboard, let's just let them write and not bother asking about the pen
toppaper.attackby(W, user)
return
var/writeonwhat = input(user, "Write on [toppaper.name], or place your pen in [src]?", "Pick one!") as null|anything in list("Write", "Place pen")
if(!Adjacent(user) || user.incapacitated())
return
switch(writeonwhat)
if("Write")
toppaper.attackby(W, user)
if("Place pen")
penPlacement(user, W, TRUE)
else
return
toppaper.attackby(W, user)
else if(istype(W, /obj/item/stamp) && toppaper) //We can stamp the topmost piece of paper
toppaper.attackby(W, user)
update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/folders.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
for(var/obj/item/photo/Ph in src)
dat += "<A href='?src=[UID()];remove=\ref[Ph]'>Remove</A> - <A href='?src=[UID()];look=\ref[Ph]'>[Ph.name]</A><BR>"
for(var/obj/item/paper_bundle/Pa in src)
dat += "<A href='?src=[UID()];remove=\ref[Pa]'>Remove</A> - <A href='?src=[UID()];look=\ref[Pa]'>[Pa.name]</A><BR>"
dat += "<A href='?src=[UID()];remove=\ref[Pa]'>Remove</A> - <A href='?src=[UID()];browse=\ref[Pa]'>[Pa.name]</A><BR>"
for(var/obj/item/documents/doc in src)
dat += "<A href='?src=[UID()];remove=\ref[doc]'>Remove</A> - <A href='?src=[UID()];look=\ref[doc]'>[doc.name]</A><BR>"
user << browse(dat, "window=folder")
Expand Down
78 changes: 48 additions & 30 deletions code/modules/paperwork/paper_bundle.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/obj/item/paper_bundle
name = "paper bundle"
gender = PLURAL
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "paper"
item_state = "paper"
Expand All @@ -11,9 +10,12 @@
layer = 4
pressure_resistance = 2
attack_verb = list("bapped")
var/amount = 0 //Amount of items clipped to the paper. Note: If you have 2 paper, this should be 1
var/amount = 0 //Amount of total items clipped to the paper. Note: If you have 2 paper, this should be 1
var/photos = 0 //Amount of photos clipped to the paper.
var/page = 1
var/screen = 0
drop_sound = 'sound/items/handling/paper_drop.ogg'
pickup_sound = 'sound/items/handling/paper_pickup.ogg'

/obj/item/paper_bundle/New(default_papers = TRUE)
. = ..()
Expand Down Expand Up @@ -46,6 +48,7 @@
H.update_inv_r_hand()
else if(istype(W, /obj/item/photo))
amount++
photos++
if(screen == 2)
screen = 1
to_chat(user, "<span class='notice'>You add [(W.name == "photo") ? "the photo" : W.name] to [(src.name == "paper bundle") ? "the paper bundle" : src.name].</span>")
Expand All @@ -69,28 +72,26 @@
P = src[page]
P.attackby(W, user, params)


update_icon()
if(winget(usr, "PaperBundle[UID()]", "is-visible") == "true") // NOT MY FAULT IT IS A BUILT IN PROC PLEASE DO NOT HIT ME
attack_self(usr) //Update the browsed page.
add_fingerprint(usr)
return


/obj/item/paper_bundle/proc/burnpaper(obj/item/lighter/P, mob/user)
var/class = "<span class='warning'>"

if(P.lit && !user.restrained())
if(istype(P, /obj/item/lighter/zippo))
class = "<span class='rose'>"

user.visible_message("[class][user] holds [P] up to [src], it looks like [user.p_theyre()] trying to burn it!", \
"[class]You hold [P] up to [src], burning it slowly.")
user.visible_message("[class][user] holds [P] up to [src], it looks like [user.p_theyre()] trying to burn it!</span>", \
"[class]You hold [P] up to [src], burning it slowly.</span>")

spawn(20)
if(get_dist(src, user) < 2 && user.get_active_hand() == P && P.lit)
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.")
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>")

if(user.is_in_inactive_hand(src))
user.unEquip(src)
Expand Down Expand Up @@ -140,14 +141,12 @@
/obj/item/paper_bundle/attack_self(mob/user as mob)
show_content(user)
add_fingerprint(usr)
update_icon()
return

/obj/item/paper_bundle/Topic(href, href_list)
if(..())
return

if((src in usr.contents) || (istype(src.loc, /obj/item/folder) && (src.loc in usr.contents)))
if(src in usr.contents)
if(href_list["next_page"])
if(page == amount)
screen = 2
Expand All @@ -156,7 +155,7 @@
else if(page == amount+1)
return
page++
playsound(src.loc, "pageturn", 50, 1)
playsound(loc, "pageturn", 50, 1)

if(href_list["prev_page"])
if(page == 1)
Expand All @@ -166,7 +165,7 @@
else if(page == amount+1)
screen = 1
page--
playsound(src.loc, "pageturn", 50, 1)
playsound(loc, "pageturn", 50, 1)

if(href_list["remove"])
var/obj/item/W = src[page]
Expand All @@ -177,6 +176,11 @@
usr.unEquip(src)
usr.put_in_hands(P)
usr.unset_machine() // Ensure the bundle GCs
for(var/obj/O in src) // just in case we somehow lose something (it's happened, especially with photos)
O.forceMove(usr.loc)
O.layer = initial(O.layer)
O.plane = initial(O.plane)
O.add_fingerprint(usr)
qdel(src)
return

Expand All @@ -190,11 +194,16 @@
update_icon()
else
to_chat(usr, "<span class='notice'>You need to hold it in your hands to change pages.</span>")

if(istype(loc, /mob))
attack_self(loc)

/obj/item/paper_bundle/AltClick(mob/user)
if(in_range(user, src) && !user.incapacitated())
if(is_pen(user.get_active_hand()))
rename()
return

. = ..()

/obj/item/paper_bundle/verb/rename()
set name = "Rename bundle"
Expand Down Expand Up @@ -227,39 +236,48 @@

/obj/item/paper_bundle/update_desc()
. = ..()
if(amount == (photos - 1))
desc = "[photos] photos clipped together." // In case you clip 2 photos together and remove the paper
return

else if(((amount + 1) - photos) >= 2) // extra papers + original paper - photos
desc = "[(amount + 1) - photos] papers clipped to each other."

if(amount > 1)
desc = "[amount] papers clipped to each other."
else
desc = "A single sheet of paper."

if(locate(/obj/item/photo) in src)
desc += "\nThere is a photo attached to it."

if(photos)
desc += "\nThere [photos == 1 ? "is a photo" : "are [photos] photos"] attached to it."
/obj/item/paper_bundle/update_icon_state()
if(contents.len)
var/obj/item/paper/P = src[1]
icon_state = P.overlays
if(length(contents))
var/obj/item/paper/P = contents[1]
icon_state = P.icon_state // must have an icon_state to show up on clipboards

/obj/item/paper_bundle/update_overlays()
. = ..()
underlays.Cut()
if(contents.len)
var/obj/item/paper/P = src[1]
if(length(contents))
var/obj/item/paper/P = contents[1]
. += P.overlays

var/counter = 0
for(var/obj/O in src)
var/image/sheet = image('icons/obj/bureaucracy.dmi')
if(istype(O, /obj/item/paper))
if(length(underlays) == 3)
continue

sheet.icon_state = O.icon_state
sheet.pixel_x -= min(1 * amount, 2)
sheet.pixel_y -= min(1 * amount, 2)
pixel_x = min(0.5 * amount, 1)
pixel_y = min(1 * amount, 2)
sheet.pixel_x -= min(1 * counter, 2)
sheet.pixel_y -= min(1 * counter, 2)
pixel_x = min(0.5 * counter, 1)
pixel_y = min(1 * counter, 2)
underlays += sheet
counter++

else if(istype(O, /obj/item/photo))
var/obj/item/photo/picture = O
. += picture.tiny
sheet = picture.tiny
. += sheet

. += "clip"
update_desc()
5 changes: 5 additions & 0 deletions code/modules/paperwork/paperplane.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
H.emote("scream")

/obj/item/paper/AltClick(mob/user, obj/item/I)
if(in_range(user, src) && !user.incapacitated())
if(is_pen(user.get_active_hand()))
rename()
return

if(ishuman(user))
var/mob/living/carbon/human/H = user
I = H.is_in_hands(/obj/item/paper)
Expand Down
58 changes: 37 additions & 21 deletions code/modules/paperwork/photography.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
icon = 'icons/obj/items.dmi'
icon_state = "photo"
item_state = "paper"
w_class = WEIGHT_CLASS_SMALL
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
max_integrity = 50
var/blueprints = 0 // Does this have the blueprints?
Expand Down Expand Up @@ -56,20 +56,17 @@
if(istype(P, /obj/item/lighter/zippo))
class = "<span class='rose'>"

user.visible_message("[class][user] holds \the [P] up to \the [src], it looks like [user.p_theyre()] trying to burn it!", \
"[class]You hold [P] up to [src], burning it slowly.")

spawn(20)
if(get_dist(src, user) < 2 && user.get_active_hand() == P && P.lit)
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.")
user.visible_message("[class][user] holds \the [P] up to \the [src], it looks like [user.p_theyre()] trying to burn it!</span>", \
"[class]You hold [P] up to [src], burning it slowly.</span>")

if(do_after(user, 50, target = src))
if(user.get_active_hand() == P && P.lit)
user.visible_message("[class][user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>", \
"[class]You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>")
if(user.is_in_inactive_hand(src))
user.unEquip(src)

new /obj/effect/decal/cleanable/ash(get_turf(src))
qdel(src)

else
to_chat(user, "<span class='warning'>You must hold \the [P] steady to burn \the [src].</span>")

Expand Down Expand Up @@ -117,11 +114,16 @@
**************/
/obj/item/storage/photo_album
name = "Photo album"
desc = "A slim book with little plastic coverings to keep photos from deteriorating, it reminds you of the good ol' days."
icon = 'icons/obj/items.dmi'
icon_state = "album"
item_state = "briefcase"
item_state = "syringe_kit"
can_hold = list(/obj/item/photo)
resistance_flags = FLAMMABLE
w_class = WEIGHT_CLASS_SMALL
storage_slots = 14
drop_sound = 'sound/items/handling/book_drop.ogg'
pickup_sound = 'sound/items/handling/book_pickup.ogg'

/obj/item/storage/photo_album/MouseDrop(obj/over_object as obj)

Expand Down Expand Up @@ -153,7 +155,7 @@
/obj/item/camera
name = "camera"
icon = 'icons/obj/items.dmi'
desc = "A polaroid camera. 10 photos left."
desc = "A polaroid camera."
icon_state = "camera"
item_state = "electropack"
w_class = WEIGHT_CLASS_SMALL
Expand All @@ -169,7 +171,12 @@
var/size = 3
var/see_ghosts = FALSE //for the spoop of it
var/current_photo_num = 1
var/digital = FALSE

/obj/item/camera/examine(mob/user)
. = ..()
if(!digital)
. += "<span class='notice'>There is [pictures_left] photos left.</span>"

/obj/item/camera/spooky/CheckParts(list/parts_list)
..()
Expand All @@ -188,6 +195,12 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
desc = "A polaroid camera, some say it can see ghosts!"
see_ghosts = TRUE

/obj/item/camera/AltClick(mob/user)
if(in_range(user, src) && !user.incapacitated())
change_size()
return
. = ..()

/obj/item/camera/verb/change_size()
set name = "Set Photo Focus"
set category = "Object"
Expand Down Expand Up @@ -339,7 +352,6 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
set_light(3, 2, LIGHT_COLOR_TUNGSTEN)
addtimer(CALLBACK(src, /atom./proc/set_light, 0), 2)
pictures_left--
desc = "A polaroid camera. It has [pictures_left] photos left."
to_chat(user, "<span class='notice'>[pictures_left] photos left.</span>")
icon_state = icon_off
on = FALSE
Expand Down Expand Up @@ -452,23 +464,27 @@ GLOBAL_LIST_INIT(SpookyGhosts, list("ghost","shade","shade2","ghost-narsie","hor
******************/
/obj/item/camera/digital
name = "digital camera"
desc = "A digital camera. A small screen shows there is space for 10 photos left."
desc = "A digital camera."
digital = TRUE
var/list/datum/picture/saved_pictures = list()
pictures_left = 30
var/max_storage = 10

/obj/item/camera/digital/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
if(!on || !pictures_left || ismob(target.loc)) return
captureimage(target, user, flag)
/obj/item/camera/digital/examine(mob/user)
. = ..()
. += "<span class='notice'>A small screen shows that there are currently [length(saved_pictures)] pictures stored.</span>"

/obj/item/camera/digital/afterattack(atom/target, mob/user, flag)
if(!on || !pictures_left || ismob(target.loc))
return

captureimage(target, user, flag)
playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 75, 1, -3)

desc = "A digital camera. A small screen shows that there are currently [saved_pictures.len] pictures stored."
icon_state = icon_off
on = FALSE
spawn(64)
icon_state = icon_on
on = TRUE
on_cooldown = TRUE
addtimer(CALLBACK(src, .proc/reset_cooldown), 6.4 SECONDS) // magic numbers here too

/obj/item/camera/digital/captureimage(atom/target, mob/user, flag)
if(saved_pictures.len >= max_storage)
Expand Down

0 comments on commit b218813

Please sign in to comment.