mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-02-06 14:19:43 +00:00
@@ -1483,61 +1483,92 @@
|
||||
log_admin("[src.owner] replied to [key_name(H)]'s illegal message with the message [input].")
|
||||
H << "You hear something crackle in your headset for a moment before a voice speaks. \"Please stand by for a message from your benefactor. Message as follows, agent. <b>\"[input]\"</b> Message ends.\""
|
||||
|
||||
else if(href_list["CentcommFaxView"])
|
||||
var/info = locate(href_list["CentcommFaxView"])
|
||||
else if(href_list["AdminFaxView"])
|
||||
var/obj/item/fax = locate(href_list["AdminFaxView"])
|
||||
if (istype(fax, /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = fax
|
||||
P.show_content(usr)
|
||||
else if (istype(fax, /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/H = fax
|
||||
H.show(usr)
|
||||
else if (istype(fax, /obj/item/weapon/paper_bundle))
|
||||
//having multiple people turning pages on a paper_bundle can cause issues
|
||||
//open a browse window listing the contents instead
|
||||
var/data = ""
|
||||
var/obj/item/weapon/paper_bundle/B = fax
|
||||
|
||||
for (var/page = 1, page <= B.amount, page++)
|
||||
var/obj/pageobj = B.contents[page]
|
||||
data += "<A href='?src=\ref[src];AdminFaxViewPage=[page];paper_bundle=\ref[B]'>Page [page] - [pageobj.name]</A><BR>"
|
||||
|
||||
world << data
|
||||
world << "usr = [usr]"
|
||||
|
||||
usr << browse(data, "window=[B.name]")
|
||||
else
|
||||
usr << "\red The faxed item is not viewable. This is probably a bug, and should be reported on the tracker: [fax.type]"
|
||||
|
||||
usr << browse("<HTML><HEAD><TITLE>Centcomm Fax Message</TITLE></HEAD><BODY>[info]</BODY></HTML>", "window=Centcomm Fax Message")
|
||||
else if (href_list["AdminFaxViewPage"])
|
||||
var/page = text2num(href_list["AdminFaxViewPage"])
|
||||
var/obj/item/weapon/paper_bundle/bundle = locate(href_list["paper_bundle"])
|
||||
|
||||
if (!bundle) return
|
||||
|
||||
if (istype(bundle.contents[page], /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = bundle.contents[page]
|
||||
P.show_content(src.owner, 1)
|
||||
else if (istype(bundle.contents[page], /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/H = bundle.contents[page]
|
||||
H.show(src.owner)
|
||||
return
|
||||
|
||||
else if(href_list["CentcommFaxReply"])
|
||||
var/mob/living/carbon/human/H = locate(href_list["CentcommFaxReply"])
|
||||
var/obj/machinery/faxmachine/fax = locate(href_list["originfax"])
|
||||
var/mob/sender = locate(href_list["CentcommFaxReply"])
|
||||
var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"])
|
||||
|
||||
var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
|
||||
var/input = input(src.owner, "Please enter a message to reply to [key_name(sender)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
|
||||
if(!input) return
|
||||
|
||||
var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null
|
||||
|
||||
// Create the reply message
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( null ) //hopefully the null loc won't cause trouble for us
|
||||
P.name = "[command_name()]- [customname]"
|
||||
P.info = input
|
||||
P.update_icon()
|
||||
|
||||
// Stamps
|
||||
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
|
||||
stampoverlay.icon_state = "paper_stamp-cent"
|
||||
if(!P.stamped)
|
||||
P.stamped = new
|
||||
P.stamped += /obj/item/weapon/stamp
|
||||
P.overlays += stampoverlay
|
||||
P.stamps += "<HR><i>This paper has been stamped by the Central Command Quantum Relay.</i>"
|
||||
|
||||
for(var/obj/machinery/faxmachine/F in machines)
|
||||
if(F == fax)
|
||||
if(! (F.stat & (BROKEN|NOPOWER) ) )
|
||||
|
||||
// animate! it's alive!
|
||||
flick("faxreceive", F)
|
||||
|
||||
// give the sprite some time to flick
|
||||
spawn(20)
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper( F.loc )
|
||||
P.name = "[command_name()]- [customname]"
|
||||
P.info = input
|
||||
P.update_icon()
|
||||
|
||||
playsound(F.loc, "sound/items/polaroid1.ogg", 50, 1)
|
||||
|
||||
// Stamps
|
||||
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
|
||||
stampoverlay.icon_state = "paper_stamp-cent"
|
||||
if(!P.stamped)
|
||||
P.stamped = new
|
||||
P.stamped += /obj/item/weapon/stamp
|
||||
P.overlays += stampoverlay
|
||||
P.stamps += "<HR><i>This paper has been stamped by the Central Command Quantum Relay.</i>"
|
||||
|
||||
src.owner << "Message reply to transmitted successfully."
|
||||
log_admin("[key_name(src.owner)] replied to a fax message from [key_name(H)]: [input]")
|
||||
message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(H)]", 1)
|
||||
return
|
||||
src.owner << "/red Unable to locate fax!"
|
||||
if(fax.recievefax(P))
|
||||
src.owner << "\blue Message reply to transmitted successfully."
|
||||
log_admin("[key_name(src.owner)] replied to a fax message from [key_name(sender)]: [input]")
|
||||
message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(sender)]", 1)
|
||||
else
|
||||
src.owner << "\red Message reply failed."
|
||||
|
||||
spawn(100)
|
||||
del(P)
|
||||
return
|
||||
|
||||
else if(href_list["SolGovFaxReply"])
|
||||
//TODO
|
||||
/*
|
||||
var/mob/living/carbon/human/H = locate(href_list["SolGovFaxReply"])
|
||||
var/obj/machinery/faxmachine/fax = locate(href_list["originfax"])
|
||||
var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"])
|
||||
|
||||
var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
|
||||
if(!input) return
|
||||
|
||||
var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null
|
||||
|
||||
for(var/obj/machinery/faxmachine/F in machines)
|
||||
for(var/obj/machinery/photocopier/faxmachine/F in machines)
|
||||
if(F == fax)
|
||||
if(! (F.stat & (BROKEN|NOPOWER) ) )
|
||||
|
||||
@@ -1567,6 +1598,7 @@
|
||||
message_admins("[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(H)]", 1)
|
||||
return
|
||||
src.owner << "/red Unable to locate fax!"
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
218
code/modules/paperwork/faxmachine.dm
Normal file
218
code/modules/paperwork/faxmachine.dm
Normal file
@@ -0,0 +1,218 @@
|
||||
var/list/obj/machinery/photocopier/faxmachine/allfaxes = list()
|
||||
var/list/admin_departments = list("Central Command", "Sol Government")
|
||||
var/list/alldepartments = list()
|
||||
|
||||
var/list/adminfaxes = list() //cache for faxes that have been sent to admins
|
||||
|
||||
/obj/machinery/photocopier/faxmachine
|
||||
name = "fax machine"
|
||||
icon = 'icons/obj/library.dmi'
|
||||
icon_state = "fax"
|
||||
insert_anim = "faxsend"
|
||||
req_one_access = list(access_lawyer, access_heads, access_armory) //Warden needs to be able to Fax solgov too.
|
||||
|
||||
use_power = 1
|
||||
idle_power_usage = 30
|
||||
active_power_usage = 200
|
||||
|
||||
var/obj/item/weapon/card/id/scan = null // identification
|
||||
var/authenticated = 0
|
||||
var/sendcooldown = 0 // to avoid spamming fax messages
|
||||
|
||||
var/department = "Unknown" // our department
|
||||
|
||||
var/destination = "Central Command" // the department we're sending to
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/New()
|
||||
..()
|
||||
allfaxes += src
|
||||
|
||||
if( !(("[department]" in alldepartments) || ("[department]" in admin_departments)) )
|
||||
alldepartments |= department
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = "Fax Machine<BR>"
|
||||
|
||||
var/scan_name
|
||||
if(scan)
|
||||
scan_name = scan.name
|
||||
else
|
||||
scan_name = "--------"
|
||||
|
||||
dat += "Confirm Identity: <a href='byond://?src=\ref[src];scan=1'>[scan_name]</a><br>"
|
||||
|
||||
if(authenticated)
|
||||
dat += "<a href='byond://?src=\ref[src];logout=1'>{Log Out}</a>"
|
||||
else
|
||||
dat += "<a href='byond://?src=\ref[src];auth=1'>{Log In}</a>"
|
||||
|
||||
dat += "<hr>"
|
||||
|
||||
if(authenticated)
|
||||
dat += "<b>Logged in to:</b> Central Command Quantum Entanglement Network<br><br>"
|
||||
|
||||
if(copyitem)
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Item</a><br><br>"
|
||||
|
||||
if(sendcooldown)
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
|
||||
else
|
||||
|
||||
dat += "<a href='byond://?src=\ref[src];send=1'>Send</a><br>"
|
||||
dat += "<b>Currently sending:</b> [copyitem.name]<br>"
|
||||
dat += "<b>Sending to:</b> <a href='byond://?src=\ref[src];dept=1'>[destination]</a><br>"
|
||||
|
||||
else
|
||||
if(sendcooldown)
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
else
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
|
||||
else
|
||||
dat += "Proper authentication is required to use this device.<br><br>"
|
||||
|
||||
if(copyitem)
|
||||
dat += "<a href ='byond://?src=\ref[src];remove=1'>Remove Item</a><br>"
|
||||
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/Topic(href, href_list)
|
||||
if(href_list["send"])
|
||||
if(copyitem)
|
||||
if (destination in admin_departments)
|
||||
send_admin_fax(usr, destination)
|
||||
else
|
||||
sendfax(destination)
|
||||
|
||||
if (sendcooldown)
|
||||
spawn(sendcooldown) // cooldown time
|
||||
sendcooldown = 0
|
||||
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
usr << "<span class='notice'>You take \the [copyitem] out of \the [src].</span>"
|
||||
copyitem = null
|
||||
updateUsrDialog()
|
||||
|
||||
if(href_list["scan"])
|
||||
if (scan)
|
||||
if(ishuman(usr))
|
||||
scan.loc = usr.loc
|
||||
if(!usr.get_active_hand())
|
||||
usr.put_in_hands(scan)
|
||||
scan = null
|
||||
else
|
||||
scan.loc = src.loc
|
||||
scan = null
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id))
|
||||
usr.drop_item()
|
||||
I.loc = src
|
||||
scan = I
|
||||
authenticated = 0
|
||||
|
||||
if(href_list["dept"])
|
||||
var/lastdestination = destination
|
||||
destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
|
||||
if(!destination) destination = lastdestination
|
||||
|
||||
if(href_list["auth"])
|
||||
if ( (!( authenticated ) && (scan)) )
|
||||
if (check_access(scan))
|
||||
authenticated = 1
|
||||
|
||||
if(href_list["logout"])
|
||||
authenticated = 0
|
||||
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
use_power(200)
|
||||
|
||||
var/success = 0
|
||||
for(var/obj/machinery/photocopier/faxmachine/F in allfaxes)
|
||||
if( F.department == destination )
|
||||
success = F.recievefax(copyitem)
|
||||
|
||||
if (success)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
//sendcooldown = 600
|
||||
else
|
||||
visible_message("[src] beeps, \"Error transmitting message.\"")
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/recievefax(var/obj/item/incoming)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return 0
|
||||
|
||||
if(department == "Unknown")
|
||||
return 0 //You can't send faxes to "Unknown"
|
||||
|
||||
flick("faxreceive", src)
|
||||
playsound(loc, "sound/items/polaroid1.ogg", 50, 1)
|
||||
|
||||
// give the sprite some time to flick
|
||||
sleep(20)
|
||||
|
||||
if (istype(incoming, /obj/item/weapon/paper))
|
||||
copy(incoming)
|
||||
else if (istype(incoming, /obj/item/weapon/photo))
|
||||
photocopy(incoming)
|
||||
else if (istype(incoming, /obj/item/weapon/paper_bundle))
|
||||
bundlecopy(incoming)
|
||||
else
|
||||
return 0
|
||||
|
||||
use_power(active_power_usage)
|
||||
return 1
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/send_admin_fax(var/mob/sender, var/destination)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
use_power(200)
|
||||
|
||||
var/obj/item/rcvdcopy
|
||||
if (istype(copyitem, /obj/item/weapon/paper))
|
||||
rcvdcopy = copy(copyitem)
|
||||
else if (istype(copyitem, /obj/item/weapon/photo))
|
||||
rcvdcopy = photocopy(copyitem)
|
||||
else if (istype(copyitem, /obj/item/weapon/paper_bundle))
|
||||
rcvdcopy = bundlecopy(copyitem)
|
||||
else
|
||||
visible_message("[src] beeps, \"Error transmitting message.\"")
|
||||
return
|
||||
|
||||
rcvdcopy.loc = null //hopefully this shouldn't cause trouble
|
||||
adminfaxes += rcvdcopy
|
||||
|
||||
//message badmins that a fax has arrived
|
||||
switch(destination)
|
||||
if ("Central Command")
|
||||
message_admins(sender, "CENTCOMM FAX", rcvdcopy, "CentcommFaxReply", "#006100")
|
||||
if ("Sol Government")
|
||||
message_admins(sender, "SOL GOVERNMENT FAX", rcvdcopy, "CentcommFaxReply", "#1F66A0")
|
||||
//message_admins(sender, "SOL GOVERNMENT FAX", rcvdcopy, "SolGovFaxReply", "#1F66A0")
|
||||
|
||||
sendcooldown = 1800
|
||||
sleep(50)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/reply_type, font_colour="#006100")
|
||||
var/msg = "\blue <b><font color='[font_colour]'>[faxname]: </font>[key_name(sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[sender]'>PP</A>) (<A HREF='?_src_=vars;Vars=\ref[sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<a href='?_src_=holder;[reply_type]=\ref[sender];originfax=\ref[src]'>REPLY</a>)</b>: Receiving '[sent.name]' via secure connection ... <a href='?_src_=holder;AdminFaxView=\ref[sent]'>view message</a>"
|
||||
|
||||
for(var/client/C in admins)
|
||||
if(R_ADMIN & C.holder.rights)
|
||||
C << msg
|
||||
@@ -60,20 +60,20 @@
|
||||
icon_state = "paper"
|
||||
|
||||
/obj/item/weapon/paper/examine(mob/user)
|
||||
// ..() //We don't want them to see the dumb "this is a paper" thing every time.
|
||||
// I didn't like the idea that people can read tiny pieces of paper from across the room.
|
||||
// Now you need to be next to the paper in order to read it.
|
||||
if(in_range(user, src))
|
||||
if(!(istype(user, /mob/living/carbon/human) || istype(user, /mob/dead/observer) || istype(user, /mob/living/silicon)))
|
||||
user << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(user, "[name]")
|
||||
else
|
||||
user << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(user, "[name]")
|
||||
show_content(usr)
|
||||
else
|
||||
user << "<span class='notice'>It is too far away.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/paper/proc/show_content(var/mob/user, var/forceshow=0)
|
||||
if(!(istype(user, /mob/living/carbon/human) || istype(user, /mob/dead/observer) || istype(user, /mob/living/silicon)) && !forceshow)
|
||||
user << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(user, "[name]")
|
||||
else
|
||||
user << browse("<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[info][stamps]</BODY></HTML>", "window=[name]")
|
||||
onclose(user, "[name]")
|
||||
|
||||
/obj/item/weapon/paper/verb/rename()
|
||||
set name = "Rename paper"
|
||||
set category = "Object"
|
||||
|
||||
@@ -93,55 +93,51 @@
|
||||
else
|
||||
user << "\red You must hold \the [P] steady to burn \the [src]."
|
||||
|
||||
|
||||
/obj/item/weapon/paper_bundle/examine(mob/user)
|
||||
if(..(user, 1))
|
||||
src.attack_self(user)
|
||||
src.show_content(user)
|
||||
else
|
||||
user << "<span class='notice'>It is too far away.</span>"
|
||||
return
|
||||
|
||||
/obj/item/weapon/paper_bundle/proc/show_content(mob/user as mob)
|
||||
var/dat
|
||||
var/obj/item/weapon/W = src[page]
|
||||
switch(screen)
|
||||
if(0)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
||||
if(1)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
||||
if(2)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV><BR><HR>"
|
||||
dat+= "<DIV STYLE='float;left; text-align:right; with:33.33333%'></DIV>"
|
||||
if(istype(src[page], /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = W
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)))
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
|
||||
else
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
|
||||
user << browse(dat, "window=[name]")
|
||||
else if(istype(src[page], /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/P = W
|
||||
user << browse_rsc(P.img, "tmp_photo.png")
|
||||
user << browse(dat + "<html><head><title>[P.name]</title></head>" \
|
||||
+ "<body style='overflow:hidden'>" \
|
||||
+ "<div> <img src='tmp_photo.png' width = '180'" \
|
||||
+ "[P.scribble ? "<div> Written on the back:<br><i>[P.scribble]</i>" : ]"\
|
||||
+ "</body></html>", "window=[name]")
|
||||
|
||||
/obj/item/weapon/paper_bundle/attack_self(mob/user as mob)
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/human_user = user
|
||||
var/dat
|
||||
var/obj/item/weapon/W = src[page]
|
||||
switch(screen)
|
||||
if(0)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
||||
if(1)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
||||
if(2)
|
||||
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
||||
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/weapon/paper)) ? "paper" : "photo"]</A></DIV><BR><HR>"
|
||||
dat+= "<DIV STYLE='float;left; text-align:right; with:33.33333%'></DIV>"
|
||||
if(istype(src[page], /obj/item/weapon/paper))
|
||||
var/obj/item/weapon/paper/P = W
|
||||
if(!(istype(usr, /mob/living/carbon/human) || istype(usr, /mob/dead/observer) || istype(usr, /mob/living/silicon)))
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
|
||||
else
|
||||
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
|
||||
human_user << browse(dat, "window=[name]")
|
||||
P.add_fingerprint(usr)
|
||||
else if(istype(src[page], /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/P = W
|
||||
human_user << browse_rsc(P.img, "tmp_photo.png")
|
||||
human_user << browse(dat + "<html><head><title>[P.name]</title></head>" \
|
||||
+ "<body style='overflow:hidden'>" \
|
||||
+ "<div> <img src='tmp_photo.png' width = '180'" \
|
||||
+ "[P.scribble ? "<div> Written on the back:<br><i>[P.scribble]</i>" : ]"\
|
||||
+ "</body></html>", "window=[name]")
|
||||
P.add_fingerprint(usr)
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
src.show_content(user)
|
||||
add_fingerprint(usr)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/paper_bundle/Topic(href, href_list)
|
||||
..()
|
||||
if((src in usr.contents) || (istype(src.loc, /obj/item/weapon/folder) && (src.loc in usr.contents)))
|
||||
|
||||
@@ -2,210 +2,159 @@
|
||||
name = "photocopier"
|
||||
icon = 'icons/obj/library.dmi'
|
||||
icon_state = "bigscanner"
|
||||
var/insert_anim = "bigscanner1"
|
||||
anchored = 1
|
||||
density = 1
|
||||
use_power = 1
|
||||
idle_power_usage = 30
|
||||
active_power_usage = 200
|
||||
power_channel = EQUIP
|
||||
var/obj/item/weapon/paper/copy = null //what's in the copier!
|
||||
var/obj/item/weapon/photo/photocopy = null
|
||||
var/obj/item/weapon/paper_bundle/bundle = null
|
||||
var/obj/item/copyitem = null //what's in the copier!
|
||||
var/copies = 1 //how many copies to print!
|
||||
var/toner = 30 //how much toner is left! woooooo~
|
||||
var/maxcopies = 10 //how many copies can be copied at once- idea shamelessly stolen from bs12's copier!
|
||||
|
||||
attack_ai(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
/obj/machinery/photocopier/attack_ai(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
/obj/machinery/photocopier/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
|
||||
var/dat = "Photocopier<BR><BR>"
|
||||
if(copy || photocopy || bundle)
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Paper</a><BR>"
|
||||
if(toner)
|
||||
dat += "<a href='byond://?src=\ref[src];copy=1'>Copy</a><BR>"
|
||||
dat += "Printing: [copies] copies."
|
||||
dat += "<a href='byond://?src=\ref[src];min=1'>-</a> "
|
||||
dat += "<a href='byond://?src=\ref[src];add=1'>+</a><BR><BR>"
|
||||
else if(toner)
|
||||
dat += "Please insert paper to copy.<BR><BR>"
|
||||
if(istype(user,/mob/living/silicon))
|
||||
dat += "<a href='byond://?src=\ref[src];aipic=1'>Print photo from database</a><BR><BR>"
|
||||
dat += "Current toner level: [toner]"
|
||||
if(!toner)
|
||||
dat +="<BR>Please insert a new toner cartridge!"
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
return
|
||||
|
||||
Topic(href, href_list)
|
||||
if(href_list["copy"])
|
||||
if(copy)
|
||||
for(var/i = 0, i < copies, i++)
|
||||
if(toner > 0)
|
||||
copy(copy)
|
||||
sleep(15)
|
||||
else
|
||||
break
|
||||
updateUsrDialog()
|
||||
else if(photocopy)
|
||||
for(var/i = 0, i < copies, i++)
|
||||
if(toner > 0)
|
||||
photocopy(photocopy)
|
||||
sleep(15)
|
||||
else
|
||||
break
|
||||
updateUsrDialog()
|
||||
else if(bundle)
|
||||
for(var/i = 0, i < copies, i++)
|
||||
if(toner <= 0)
|
||||
break
|
||||
var/obj/item/weapon/paper_bundle/p = new /obj/item/weapon/paper_bundle (src)
|
||||
var/j = 0
|
||||
for(var/obj/item/weapon/W in bundle)
|
||||
if(toner <= 0)
|
||||
usr << "<span class='notice'>The photocopier couldn't finish the printjob.</span>"
|
||||
break
|
||||
else if(istype(W, /obj/item/weapon/paper))
|
||||
W = copy(W)
|
||||
else if(istype(W, /obj/item/weapon/photo))
|
||||
W = photocopy(W)
|
||||
W.loc = p
|
||||
p.amount++
|
||||
j++
|
||||
p.amount--
|
||||
p.loc = src.loc
|
||||
p.update_icon()
|
||||
p.icon_state = "paper_words"
|
||||
p.name = bundle.name
|
||||
p.pixel_y = rand(-8, 8)
|
||||
p.pixel_x = rand(-9, 9)
|
||||
sleep(15*j)
|
||||
updateUsrDialog()
|
||||
else if(href_list["remove"])
|
||||
if(copy)
|
||||
copy.loc = usr.loc
|
||||
usr.put_in_hands(copy)
|
||||
usr << "<span class='notice'>You take the paper out of \the [src].</span>"
|
||||
copy = null
|
||||
updateUsrDialog()
|
||||
else if(photocopy)
|
||||
photocopy.loc = usr.loc
|
||||
usr.put_in_hands(photocopy)
|
||||
usr << "<span class='notice'>You take the photo out of \the [src].</span>"
|
||||
photocopy = null
|
||||
updateUsrDialog()
|
||||
else if(bundle)
|
||||
bundle.loc = usr.loc
|
||||
usr.put_in_hands(bundle)
|
||||
usr << "<span class='notice'>You take the paper bundle out of \the [src].</span>"
|
||||
bundle = null
|
||||
updateUsrDialog()
|
||||
else if(href_list["min"])
|
||||
if(copies > 1)
|
||||
copies--
|
||||
updateUsrDialog()
|
||||
else if(href_list["add"])
|
||||
if(copies < maxcopies)
|
||||
copies++
|
||||
updateUsrDialog()
|
||||
else if(href_list["aipic"])
|
||||
if(!istype(usr,/mob/living/silicon)) return
|
||||
if(toner >= 5)
|
||||
var/mob/living/silicon/tempAI = usr
|
||||
var/obj/item/device/camera/siliconcam/camera = tempAI.aiCamera
|
||||
|
||||
if(!camera)
|
||||
return
|
||||
var/obj/item/weapon/photo/selection = camera.selectpicture()
|
||||
if (!selection)
|
||||
return
|
||||
|
||||
var/obj/item/weapon/photo/p = photocopy(selection)
|
||||
p.loc = src.loc
|
||||
if (p.desc == "")
|
||||
p.desc += "Copy by [tempAI.name]"
|
||||
else
|
||||
p.desc += " - Copy by [tempAI.name]"
|
||||
var/dat = "Photocopier<BR><BR>"
|
||||
if(copyitem)
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Item</a><BR>"
|
||||
if(toner)
|
||||
dat += "<a href='byond://?src=\ref[src];copy=1'>Copy</a><BR>"
|
||||
dat += "Printing: [copies] copies."
|
||||
dat += "<a href='byond://?src=\ref[src];min=1'>-</a> "
|
||||
dat += "<a href='byond://?src=\ref[src];add=1'>+</a><BR><BR>"
|
||||
else if(toner)
|
||||
dat += "Please insert something to copy.<BR><BR>"
|
||||
if(istype(user,/mob/living/silicon))
|
||||
dat += "<a href='byond://?src=\ref[src];aipic=1'>Print photo from database</a><BR><BR>"
|
||||
dat += "Current toner level: [toner]"
|
||||
if(!toner)
|
||||
dat +="<BR>Please insert a new toner cartridge!"
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/Topic(href, href_list)
|
||||
if(href_list["copy"])
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
for(var/i = 0, i < copies, i++)
|
||||
if(toner <= 0)
|
||||
break
|
||||
|
||||
if (istype(copyitem, /obj/item/weapon/paper))
|
||||
copy(copyitem)
|
||||
sleep(15)
|
||||
else if (istype(copyitem, /obj/item/weapon/photo))
|
||||
photocopy(copyitem)
|
||||
sleep(15)
|
||||
else if (istype(copyitem, /obj/item/weapon/paper_bundle))
|
||||
var/obj/item/weapon/paper_bundle/B = bundlecopy(copyitem)
|
||||
sleep(15*B.amount)
|
||||
else
|
||||
usr << "<span class='notice'>The photocopier couldn't finish the printjob.</span>"
|
||||
usr << "<span class='warning'>\The [copyitem] can't be copied by \the [src].</span>"
|
||||
break
|
||||
|
||||
use_power(active_power_usage)
|
||||
updateUsrDialog()
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
copyitem.loc = usr.loc
|
||||
usr.put_in_hands(copyitem)
|
||||
usr << "<span class='notice'>You take \the [copyitem] out of \the [src].</span>"
|
||||
copyitem = null
|
||||
updateUsrDialog()
|
||||
else if(href_list["min"])
|
||||
if(copies > 1)
|
||||
copies--
|
||||
updateUsrDialog()
|
||||
else if(href_list["add"])
|
||||
if(copies < maxcopies)
|
||||
copies++
|
||||
updateUsrDialog()
|
||||
else if(href_list["aipic"])
|
||||
if(!istype(usr,/mob/living/silicon)) return
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
|
||||
if(toner >= 5)
|
||||
var/mob/living/silicon/tempAI = usr
|
||||
var/obj/item/device/camera/siliconcam/camera = tempAI.aiCamera
|
||||
|
||||
attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(istype(O, /obj/item/weapon/paper))
|
||||
if(!copy && !photocopy && !bundle)
|
||||
user.drop_item()
|
||||
copy = O
|
||||
O.loc = src
|
||||
user << "<span class='notice'>You insert the paper into \the [src].</span>"
|
||||
flick("bigscanner1", src)
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>There is already something in \the [src].</span>"
|
||||
else if(istype(O, /obj/item/weapon/photo))
|
||||
if(!copy && !photocopy && !bundle)
|
||||
user.drop_item()
|
||||
photocopy = O
|
||||
O.loc = src
|
||||
user << "<span class='notice'>You insert the photo into \the [src].</span>"
|
||||
flick("bigscanner1", src)
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>There is already something in \the [src].</span>"
|
||||
else if(istype(O, /obj/item/weapon/paper_bundle))
|
||||
if(!copy && !photocopy && !bundle)
|
||||
user.drop_item()
|
||||
bundle = O
|
||||
O.loc = src
|
||||
user << "<span class='notice'>You insert the bundle into \the [src].</span>"
|
||||
flick("bigscanner1", src)
|
||||
updateUsrDialog()
|
||||
else if(istype(O, /obj/item/device/toner))
|
||||
if(toner == 0)
|
||||
user.drop_item()
|
||||
del(O)
|
||||
toner = 30
|
||||
user << "<span class='notice'>You insert the toner cartridge into \the [src].</span>"
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>This cartridge is not yet ready for replacement! Use up the rest of the toner.</span>"
|
||||
else if(istype(O, /obj/item/weapon/wrench))
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
anchored = !anchored
|
||||
user << "<span class='notice'>You [anchored ? "wrench" : "unwrench"] \the [src].</span>"
|
||||
return
|
||||
if(!camera)
|
||||
return
|
||||
var/datum/picture/selection = camera.selectpicture()
|
||||
if (!selection)
|
||||
return
|
||||
|
||||
ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
del(src)
|
||||
if(2.0)
|
||||
if(prob(50))
|
||||
del(src)
|
||||
else
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
var/obj/item/weapon/photo/p = new /obj/item/weapon/photo (src.loc)
|
||||
p.construct(selection)
|
||||
if (p.desc == "")
|
||||
p.desc += "Copied by [tempAI.name]"
|
||||
else
|
||||
if(prob(50))
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
return
|
||||
p.desc += " - Copied by [tempAI.name]"
|
||||
toner -= 5
|
||||
sleep(15)
|
||||
updateUsrDialog()
|
||||
|
||||
blob_act()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
/obj/machinery/photocopier/attackby(obj/item/O as obj, mob/user as mob)
|
||||
if(istype(O, /obj/item/weapon/paper) || istype(O, /obj/item/weapon/photo) || istype(O, /obj/item/weapon/paper_bundle))
|
||||
if(!copyitem)
|
||||
user.drop_item()
|
||||
copyitem = O
|
||||
O.loc = src
|
||||
user << "<span class='notice'>You insert \the [O] into \the [src].</span>"
|
||||
flick(insert_anim, src)
|
||||
updateUsrDialog()
|
||||
else
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
return
|
||||
user << "<span class='notice'>There is already something in \the [src].</span>"
|
||||
else if(istype(O, /obj/item/device/toner))
|
||||
if(toner <= 10) //allow replacing when low toner is affecting the print darkness
|
||||
user.drop_item()
|
||||
user << "<span class='notice'>You insert the toner cartridge into \the [src].</span>"
|
||||
var/obj/item/device/toner/T = O
|
||||
toner += T.toner_amount
|
||||
del(O)
|
||||
updateUsrDialog()
|
||||
else
|
||||
user << "<span class='notice'>This cartridge is not yet ready for replacement! Use up the rest of the toner.</span>"
|
||||
else if(istype(O, /obj/item/weapon/wrench))
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
anchored = !anchored
|
||||
user << "<span class='notice'>You [anchored ? "wrench" : "unwrench"] \the [src].</span>"
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
del(src)
|
||||
if(2.0)
|
||||
if(prob(50))
|
||||
del(src)
|
||||
else
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
else
|
||||
if(prob(50))
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/blob_act()
|
||||
if(prob(50))
|
||||
del(src)
|
||||
else
|
||||
if(toner > 0)
|
||||
new /obj/effect/decal/cleanable/blood/oil(get_turf(src))
|
||||
toner = 0
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/proc/copy(var/obj/item/weapon/paper/copy)
|
||||
var/obj/item/weapon/paper/c = new /obj/item/weapon/paper (loc)
|
||||
@@ -239,6 +188,8 @@
|
||||
c.overlays += img
|
||||
c.updateinfolinks()
|
||||
toner--
|
||||
if(toner == 0)
|
||||
visible_message("<span class='notice'>A red light on \the [src] flashes, indicating that it is out of toner.</span>")
|
||||
return c
|
||||
|
||||
|
||||
@@ -258,9 +209,34 @@
|
||||
toner -= 5 //photos use a lot of ink!
|
||||
if(toner < 0)
|
||||
toner = 0
|
||||
visible_message("<span class='notice'>A red light on \the [src] flashes, indicating that it is out of toner.</span>")
|
||||
return p
|
||||
|
||||
//If need_toner is 0, the copies will still be lightened when low on toner, however it will not be prevented from printing. TODO: Implement print queues for fax machines and get rid of need_toner
|
||||
/obj/machinery/photocopier/proc/bundlecopy(var/obj/item/weapon/paper_bundle/bundle, var/need_toner=1)
|
||||
var/obj/item/weapon/paper_bundle/p = new /obj/item/weapon/paper_bundle (src)
|
||||
for(var/obj/item/weapon/W in bundle)
|
||||
if(toner <= 0 && need_toner)
|
||||
toner = 0
|
||||
visible_message("<span class='notice'>A red light on \the [src] flashes, indicating that it is out of toner.</span>")
|
||||
break
|
||||
|
||||
if(istype(W, /obj/item/weapon/paper))
|
||||
W = copy(W)
|
||||
else if(istype(W, /obj/item/weapon/photo))
|
||||
W = photocopy(W)
|
||||
W.loc = p
|
||||
p.amount++
|
||||
//p.amount--
|
||||
p.loc = src.loc
|
||||
p.update_icon()
|
||||
p.icon_state = "paper_words"
|
||||
p.name = bundle.name
|
||||
p.pixel_y = rand(-8, 8)
|
||||
p.pixel_x = rand(-9, 9)
|
||||
return p
|
||||
|
||||
/obj/item/device/toner
|
||||
name = "toner cartridge"
|
||||
icon_state = "tonercartridge"
|
||||
var/toner_amount = 30
|
||||
|
||||
Reference in New Issue
Block a user