refactors admin faxes to allow for more simple to use fax creation and replying.

Admins also gain the ability to initiate faxes.
And mods can send and receive faxes now.
This commit is contained in:
NullSnapshot
2016-08-12 19:58:52 +01:00
committed by Yoshax
parent 83c515fdd9
commit e881c77c8f
7 changed files with 328 additions and 95 deletions
+91
View File
@@ -1348,6 +1348,7 @@ proc/admin_notice(var/message, var/rights)
H.paralysis = 0
msg = "has unparalyzed [key_name(H)]."
log_and_message_admins(msg)
/datum/admins/proc/set_tcrystals(mob/living/carbon/human/H as mob)
set category = "Debug"
set name = "Set Telecrystals"
@@ -1380,3 +1381,93 @@ proc/admin_notice(var/message, var/rights)
else
usr << "You do not have access to this command."
/datum/admins/proc/sendFax()
set category = "Special Verbs"
set name = "Send Fax"
set desc = "Sends a fax to this machine"
var/department = input("Choose a fax", "Fax") as null|anything in alldepartments
for(var/obj/machinery/photocopier/faxmachine/sendto in allfaxes)
if(sendto.department == department)
if (!istype(src,/datum/admins))
src = usr.client.holder
if (!istype(src,/datum/admins))
usr << "Error: you are not an admin!"
return
var/replyorigin = input(src.owner, "Please specify who the fax is coming from", "Origin") as text|null
var/obj/item/weapon/paper/admin/P = new /obj/item/weapon/paper/admin( null ) //hopefully the null loc won't cause trouble for us
faxreply = P
P.admindatum = src
P.origin = replyorigin
P.destination = sendto
P.adminbrowse()
datum/admins/var/obj/item/weapon/paper/admin/faxreply // var to hold fax replies in
/datum/admins/proc/faxCallback(var/obj/item/weapon/paper/admin/P, var/obj/machinery/photocopier/faxmachine/destination)
var/customname = input(src.owner, "Pick a title for the report", "Title") as text|null
P.name = "[P.origin] - [customname]"
P.desc = "This is a paper titled '" + P.name + "'."
var/shouldStamp = 1
if(!P.sender) // admin initiated
switch(alert("Would you like the fax stamped?",, "Yes", "No"))
if("No")
shouldStamp = 0
if(shouldStamp)
P.stamps += "<hr><i>This paper has been stamped by the [P.origin] Quantum Relay.</i>"
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
var/{x; y;}
x = rand(-2, 0)
y = rand(-1, 2)
P.offset_x += x
P.offset_y += y
stampoverlay.pixel_x = x
stampoverlay.pixel_y = y
if(!P.ico)
P.ico = new
P.ico += "paper_stamp-cent"
stampoverlay.icon_state = "paper_stamp-cent"
if(!P.stamped)
P.stamped = new
P.stamped += /obj/item/weapon/stamp/centcomm
P.overlays += stampoverlay
var/obj/item/rcvdcopy
rcvdcopy = destination.copy(P)
rcvdcopy.loc = null //hopefully this shouldn't cause trouble
adminfaxes += rcvdcopy
if(destination.recievefax(P))
src.owner << "\blue Message reply to transmitted successfully."
if(P.sender) // sent as a reply
log_admin("[key_name(src.owner)] replied to a fax message from [key_name(P.sender)]")
for(var/client/C in admins)
if((R_ADMIN | R_MOD) & C.holder.rights)
C << "<span class='log_message'><span class='prefix'>FAX LOG:</span>[key_name_admin(src.owner)] replied to a fax message from [key_name_admin(P.sender)] (<a href='?_src_=holder;AdminFaxView=\ref[rcvdcopy]'>VIEW</a>)</span>"
else
log_admin("[key_name(src.owner)] has sent a fax message to [destination.department]")
for(var/client/C in admins)
if((R_ADMIN | R_MOD) & C.holder.rights)
C << "<span class='log_message'><span class='prefix'>FAX LOG:</span>[key_name_admin(src.owner)] has sent a fax message to [destination.department] (<a href='?_src_=holder;AdminFaxView=\ref[rcvdcopy]'>VIEW</a>)</span>"
else
src.owner << "\red Message reply failed."
spawn(100)
qdel(P)
faxreply = null
return
+5 -2
View File
@@ -96,7 +96,8 @@ var/list/admin_verbs_admin = list(
/client/proc/toggle_debug_logs,
/client/proc/toggle_attack_logs,
/datum/admins/proc/paralyze_mob,
/client/proc/fixatmos
/client/proc/fixatmos,
/datum/admins/proc/sendFax
)
var/list/admin_verbs_ban = list(
/client/proc/unban_panel,
@@ -305,7 +306,9 @@ var/list/admin_verbs_mod = list(
/client/proc/cmd_admin_subtle_message, //send an message to somebody as a 'voice in their head',
/datum/admins/proc/paralyze_mob,
/client/proc/cmd_admin_direct_narrate,
/client/proc/allow_character_respawn // Allows a ghost to respawn ,
/client/proc/allow_character_respawn, // Allows a ghost to respawn ,
/datum/admins/proc/sendFax
)
var/list/admin_verbs_mentor = list(
+12 -77
View File
@@ -1386,86 +1386,21 @@
H.show(src.owner)
return
else if(href_list["CentcommFaxReply"])
var/mob/sender = locate(href_list["CentcommFaxReply"])
else if(href_list["FaxReply"])
var/mob/sender = locate(href_list["FaxReply"])
var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"])
//todo: sanitize
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>"
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)
qdel(P)
return
else if(href_list["SolGovFaxReply"])
//TODO
/*
var/mob/living/carbon/human/H = locate(href_list["SolGovFaxReply"])
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/photocopier/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 = "Sol Government- [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-cap"
if(!P.stamped)
P.stamped = new
P.stamped += /obj/item/weapon/stamp
P.overlays += stampoverlay
P.stamps += "<HR><i>This paper has been stamped and encrypted by the Sol Government 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!"
*/
var/replyorigin = href_list["replyorigin"]
var/obj/item/weapon/paper/admin/P = new /obj/item/weapon/paper/admin( null ) //hopefully the null loc won't cause trouble for us
faxreply = P
P.admindatum = src
P.origin = replyorigin
P.destination = fax
P.sender = sender
P.adminbrowse()
else if(href_list["jumpto"])
if(!check_rights(R_ADMIN)) return