Files
Paradise/code/modules/paperwork/clipboard.dm
T
Vi3triceandGitHub f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

158 lines
5.3 KiB
Plaintext

#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"
item_state = "clipboard"
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
var/obj/item/pen/containedpen
var/obj/item/toppaper
slot_flags = SLOT_BELT
resistance_flags = FLAMMABLE
/obj/item/clipboard/New()
..()
update_icon()
/obj/item/clipboard/verb/removePen(mob/user)
set category = "Object"
set name = "Remove clipboard pen"
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)
. = ..()
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 class='warning'>There's already a pen in [src]!</span>")
return
if(!is_pen(P))
return
to_chat(user, "<span class='notice'>You slide [P] into [src].</span>")
user.unEquip(P)
P.forceMove(src)
containedpen = P
else
if(!containedpen)
to_chat(user, "<span class='warning'>There isn't a pen in [src] for you to remove!</span>")
return
to_chat(user, "<span class='notice'>You remove [containedpen] from [src].</span>")
user.put_in_hands(containedpen)
containedpen = null
update_icon()
/obj/item/clipboard/proc/showClipboard(mob/user) //Show them what's on the clipboard
var/dat = "<title>[src]</title>"
dat += "<a href='?src=[UID()];doPenThings=[containedpen ? "Remove" : "Add"]'>[containedpen ? "Remove pen" : "Add pen"]</a><br><hr>"
if(toppaper)
dat += "<a href='?src=[UID()];remove=\ref[toppaper]'>Remove</a><a href='?src=[UID()];viewOrWrite=\ref[toppaper]'>[toppaper.name]</a><br><hr>"
for(var/obj/item/P in src)
if(isPaperwork(P) == PAPERWORK && P != toppaper)
dat += "<a href='?src=[UID()];remove=\ref[P]'>Remove</a><a href='?src=[UID()];topPaper=\ref[P]'>Put on top</a><a href='?src=[UID()];viewOrWrite=\ref[P]'>[P.name]</a><br>"
if(isPaperwork(P) == PHOTO)
dat += "<a href='?src=[UID()];remove=\ref[P]'>Remove</a><a href='?src=[UID()];viewOrWrite=\ref[P]'>[P.name]</a><br>"
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"
. += "clipboard_over"
/obj/item/clipboard/attackby(obj/item/W, mob/user)
if(isPaperwork(W)) //If it's a photo, paper bundle, or piece of paper, place it on the clipboard.
user.unEquip(W)
W.forceMove(src)
to_chat(user, "<span class='notice'>You clip [W] onto [src].</span>")
playsound(loc, "pageturn", 50, 1)
if(isPaperwork(W) == PAPERWORK)
toppaper = W
update_icon()
else if(is_pen(W))
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
else if(istype(W, /obj/item/stamp) && toppaper) //We can stamp the topmost piece of paper
toppaper.attackby(W, user)
update_icon()
else
return ..()
/obj/item/clipboard/attack_self(mob/user)
showClipboard(user)
/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 class='notice'>You remove [P] from [src].</span>")
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.attackby(I, usr)
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 class='notice'>You flick the pages so that [P] is on top.</span>")
playsound(loc, "pageturn", 50, 1)
toppaper = P
update_icon()
showClipboard(usr)
#undef PAPERWORK
#undef PHOTO