Tigercat formatting changes

This commit is contained in:
Citinited
2017-10-16 03:29:22 +01:00
parent 9a4a6b0001
commit acc6aaa73a
2 changed files with 33 additions and 29 deletions
+31 -29
View File
@@ -1,6 +1,5 @@
#define PAPERWORK 1
#define PHOTO 2
#define IS_PEN(x) (istype(x, /obj/item/weapon/pen))
/obj/item/weapon/clipboard
name = "clipboard"
@@ -9,6 +8,7 @@
icon_state = "clipboard"
item_state = "clipboard"
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
var/obj/item/weapon/pen/containedpen
var/obj/item/weapon/toppaper
slot_flags = SLOT_BELT
@@ -18,12 +18,12 @@
..()
update_icon()
/obj/item/weapon/clipboard/verb/removePen()
/obj/item/weapon/clipboard/verb/removePen(mob/user)
set category = "Object"
set name = "Remove clipboard pen"
if(!ishuman(usr) || usr.incapacitated())
if(!ishuman(user) || user.incapacitated())
return
penPlacement(FALSE, containedpen)
penPlacement(user, containedpen, FALSE)
/obj/item/weapon/clipboard/proc/isPaperwork(obj/item/weapon/W) //This could probably do with being somewhere else but for now it's fine here.
if(istype(W, /obj/item/weapon/paper) || istype(W, /obj/item/weapon/paper_bundle))
@@ -41,27 +41,27 @@
if(..(user, 1) && toppaper)
toppaper.examine(user)
obj/item/weapon/clipboard/proc/penPlacement(placing, obj/item/weapon/pen/P)
obj/item/weapon/clipboard/proc/penPlacement(mob/user, obj/item/weapon/pen/P, placing)
if(placing)
if(containedpen)
to_chat(usr, "<span class = 'warning'>There's already a pen in [src]!</span>")
to_chat(user, "<span class='warning'>There's already a pen in [src]!</span>")
return
if(!IS_PEN(P))
if(!is_pen(P))
return
to_chat(usr, "<span class='notice'>You slide [P] into [src].</span>")
usr.unEquip(P)
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(usr, "<span class = 'warning'>There isn't a pen in [src] for you to remove!</span>")
to_chat(user, "<span class='warning'>There isn't a pen in [src] for you to remove!</span>")
return
to_chat(usr, "<span class = 'notice'>You remove [containedpen] from [src].</span>")
usr.put_in_hands(containedpen)
to_chat(user, "<span class='notice'>You remove [containedpen] from [src].</span>")
user.put_in_hands(containedpen)
containedpen = null
update_icon()
/obj/item/weapon/clipboard/proc/show_clipboard() //Show them what's on the clipboard
/obj/item/weapon/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)
@@ -71,7 +71,7 @@ obj/item/weapon/clipboard/proc/penPlacement(placing, obj/item/weapon/pen/P)
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(usr, "clipboard", "[src]", 400, 400)
var/datum/browser/popup = new(user, "clipboard", "[src]", 400, 400)
popup.set_content(dat)
popup.open()
@@ -94,26 +94,29 @@ obj/item/weapon/clipboard/proc/penPlacement(placing, obj/item/weapon/pen/P)
if(isPaperwork(W) == PAPERWORK)
toppaper = W
update_icon()
else if(IS_PEN(W)) //If it's not a pen, we're done here
else if(is_pen(W))
if(!toppaper) //If there's no paper we can write on, just stick the pen into the clipboard
penPlacement(TRUE, W)
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(!writeonwhat)
if(!Adjacent(user) || user.incapacitated())
return
if(writeonwhat == "Write")
toppaper.attackby(W, user)
else if(writeonwhat == "Place pen")
penPlacement(TRUE, W)
switch(writeonwhat)
if("Write")
toppaper.attackby(W, user)
if("Place pen")
penPlacement(user, W, TRUE)
else
return
else if(istype(W, /obj/item/weapon/stamp) && toppaper) //We can stamp the topmost piece of paper
toppaper.attackby(W, user)
update_icon()
/obj/item/weapon/clipboard/attack_self(mob/user)
show_clipboard()
showClipboard(user)
/obj/item/weapon/clipboard/Topic(href, href_list)
..()
@@ -122,20 +125,20 @@ obj/item/weapon/clipboard/proc/penPlacement(placing, obj/item/weapon/pen/P)
var/obj/item/I = usr.get_active_hand()
if(href_list["doPenThings"])
if(href_list["doPenThings"] == "Add")
penPlacement(TRUE, I)
penPlacement(usr, I, TRUE)
else
penPlacement(FALSE, containedpen)
penPlacement(usr, containedpen, FALSE)
else if(href_list["remove"])
var/obj/item/P = locate(href_list["remove"])
if(isPaperwork(P))
usr.put_in_hands(P)
to_chat(usr, "<span class = 'notice'>You remove [P] from [src].</span>")
to_chat(usr, "<span class='notice'>You remove [P] from [src].</span>")
checkTopPaper() //So we don't accidentally make the top sheet not be on the clipboard
else if(href_list["viewOrWrite"])
var/obj/item/weapon/P = locate(href_list["viewOrWrite"])
if(!isPaperwork(P))
return
if(IS_PEN(I) && isPaperwork(P) != PHOTO) //Because you can't write on photos that aren't in your hand
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)
@@ -146,12 +149,11 @@ obj/item/weapon/clipboard/proc/penPlacement(placing, obj/item/weapon/pen/P)
var/obj/item/weapon/P = locate(href_list["topPaper"])
if(P == toppaper)
return
to_chat(usr, "<span class = 'notice'>You flick the pages so that [P] is on top.</span>")
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()
show_clipboard()
showClipboard(usr)
#undef PAPERWORK
#undef PHOTO
#undef IS_PEN