diff --git a/code/WorkInProgress/kilakk/fax.dm b/code/WorkInProgress/kilakk/fax.dm index aa478f45..85a40eeb 100644 --- a/code/WorkInProgress/kilakk/fax.dm +++ b/code/WorkInProgress/kilakk/fax.dm @@ -1,6 +1,48 @@ var/list/obj/machinery/faxmachine/allfaxes = list() var/list/alldepartments = list("Central Command") +/datum/fax_repository + var/list/received_faxes = list() + var/list/sent_faxes = list() + +/datum/fax_repository/proc/add_fax(var/data, var/subject, var/sender, var/received = 1) + if (!data || !subject || !sender) + return + + var/list/new_fax = list("data" = data, "subject" = subject, "sender" = sender) + switch (received) + if (1) + received_faxes.Add(list(new_fax)) + return received_faxes.len + if (0) + sent_faxes.Add(list(new_fax)) + return sent_faxes.len + +/datum/fax_repository/proc/get_fax(var/id, var/received = 1) + if (!id) + return + + switch (received) + if (1) + return received_faxes[id] + if (0) + return sent_faxes[id] + +/datum/fax_repository/proc/get_subjects(var/received = 1) + var/list/target_list = null + switch (received) + if (1) + target_list = received_faxes + if (0) + target_list = sent_faxes + + var/list/return_list = list() + for (var/i = 1, i <= target_list.len, i++) + return_list.Add(target_list[i]["subject"]) + return_list[target_list[i]["subject"]] = i + + return return_list + /obj/machinery/faxmachine name = "fax machine" icon = 'icons/obj/library.dmi' @@ -179,6 +221,11 @@ var/list/alldepartments = list("Central Command") /proc/Centcomm_fax(var/sent, var/sentname, var/mob/Sender) + if (!ticker) + return + + var/fax_id = ticker.fax_repository.add_fax(sent, sentname, Sender.name) + for(var/client/C in admins) var/msg = "\blue CENTCOMM FAX: " if(C.holder.rights & (R_ADMIN|R_FUN|R_MOD)) @@ -186,12 +233,14 @@ var/list/alldepartments = list("Central Command") else msg += "[key_name(Sender,0,1,0)]" - msg += " (RPLY): Receiving '[sentname]' via secure connection ... view message" + msg += " (RPLY): Receiving '[sentname]' via secure connection ... view message" if(C.holder.rights & (R_ADMIN|R_DUTYOFF|R_FUN)) C << msg -proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt) + send_to_discord("cciaa_channel", "@everyone Received fax from [Sender]. Subject: [sentname].") + +/proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt) for(var/obj/machinery/faxmachine/F in allfaxes) if( F.department == dpt ) @@ -249,4 +298,4 @@ proc/SendFax(var/sent, var/sentname, var/mob/Sender, var/dpt) L = get(PDA, /mob/living/silicon) if(L) - L << "\icon[PDA] Message from [sender], \"[message]\" (Unable to Reply)" \ No newline at end of file + L << "\icon[PDA] Message from [sender], \"[message]\" (Unable to Reply)" diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 8a7758ed..c5386cf3 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -39,6 +39,8 @@ var/global/datum/controller/gameticker/ticker var/round_end_announced = 0 // Spam Prevention. Announce round end only once. + var/datum/fax_repository/fax_repository + /datum/controller/gameticker/proc/pregame() login_music = pick(\ /*'sound/music/halloween/skeletons.ogg',\ @@ -135,6 +137,8 @@ var/global/datum/controller/gameticker/ticker //here to initialize the random events nicely at round start setup_economy() + fax_repository = new() + shuttle_controller.setup_shuttle_docks() spawn(0)//Forking here so we dont have to wait for this to finish @@ -158,6 +162,7 @@ var/global/datum/controller/gameticker/ticker admins_number++ if(admins_number == 0) send2adminirc("Round has started with no admins online.") + send_to_discord("admin_channel", "@everyone Round has started with no staff online.") supply_controller.process() //Start the supply shuttle regenerating points -- TLE master_controller.process() //Start master_controller.process() diff --git a/code/modules/admin/permissionverbs/permsission lists.dm b/code/modules/admin/permissionverbs/permsission lists.dm index bfddf36a..2502ac52 100644 --- a/code/modules/admin/permissionverbs/permsission lists.dm +++ b/code/modules/admin/permissionverbs/permsission lists.dm @@ -89,7 +89,9 @@ var/list/admin_verbs_admin = list( /client/proc/toggle_view_range, /*changes how far we can see*/ /client/proc/toggle_visibily, /client/proc/secrets, - /client/proc/set_ooc + /client/proc/set_ooc, + /client/proc/send_admin_fax, + /client/proc/check_fax_history ) var/list/admin_verbs_ban = list( @@ -145,7 +147,9 @@ var/list/admin_verbs_fun = list( /client/proc/player_panel, /client/proc/secrets, /client/proc/send_space_ninja, - /client/proc/toggle_view_range + /client/proc/toggle_view_range, + /client/proc/send_admin_fax, + /client/proc/check_fax_history ) var/list/admin_verbs_dev = list( @@ -403,7 +407,9 @@ var/list/admin_verbs_duty = list( /client/proc/cmd_admin_create_centcom_report, /client/proc/cmd_duty_say, /client/proc/returntobody, - /client/proc/view_duty_log + /client/proc/view_duty_log, + /client/proc/send_admin_fax, + /client/proc/check_fax_history ) /client/proc/add_admin_verbs() diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index d9ebaf85..9590af78 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1531,49 +1531,18 @@ H << "An encripted connection was made and a file was uploaded to your systems. \"Please stand by for a message from Central Command. Message as follows. \"[input]\" Message ends.\"" else if(href_list["CentcommFaxView"]) - var/info = locate(href_list["CentcommFaxView"]) + if (!href_list["CentcommFaxReceived"] || !ticker) + return - usr << browse("Centcomm Fax Message[info]", "window=Centcomm Fax Message") + var/list/fax = ticker.fax_repository.get_fax(text2num(href_list["CentcommFaxView"]), text2num(href_list["CentcommFaxReceived"])) + + usr << browse("Centcomm Fax Message[fax["data"]]", "window=Centcomm Fax Message") else if(href_list["CentcommFaxReply"]) - var/mob/living/carbon/human/H = locate(href_list["CentcommFaxReply"]) - - 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
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 - - //so that we alert people with certain cartidges with a PDA message. - alertFaxes() - - for(var/obj/machinery/faxmachine/F in machines) - 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 += "
This paper has been stamped by the Central Command Quantum Relay." - - 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)] view message", 1) + usr.client.send_admin_fax() + else if (href_list["CentcommFaxHistory"]) + usr.client.check_fax_history(text2num(href_list["CentcommFaxHistory"])) else if(href_list["jumpto"]) if(!check_rights(R_ADMIN|R_FUN)) return diff --git a/code/modules/aurora/duty_officer/duty officer.dm b/code/modules/aurora/duty_officer/duty officer.dm index d8867b2a..37211207 100644 --- a/code/modules/aurora/duty_officer/duty officer.dm +++ b/code/modules/aurora/duty_officer/duty officer.dm @@ -246,3 +246,99 @@ var/oldjob = M.mind.assigned_role job_master.FreeRole(oldjob) return + +/client/proc/send_admin_fax() + set name = "Send admin fax" + set desc = "Send a fax from Central Command" + set category = "Special Verbs" + + if (!check_rights(R_ADMIN|R_DUTYOFF|R_FUN)) + usr << "\red You do not have enough powers to do this." + return + + if (!ticker) + usr << "\red No ticker! Bad!" + return + + if (ticker.current_state < GAME_STATE_PLAYING) + usr << "\red The game hasn't started yet!" + return + + var/input = input(usr, "Please enter a message to send to [station_name()] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use
for line breaks.", "Outgoing message from Centcomm", "") as message|null + + if (!input) + usr << "\red Cancelled." + return + + var/customsender = input(usr, "Pick a Duty Officer name to use", "Name") as text|null + if (!customsender) + usr << "\red Name required! Cancelled." + return + + var/customname = input(usr, "Pick a title for the report", "Title") as text|null + + //so that we alert people with certain cartidges with a PDA message. + alertFaxes() + + for (var/obj/machinery/faxmachine/F in machines) + 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 += "
This paper has been stamped by the Central Command Quantum Relay." + + var/fax_id = ticker.fax_repository.add_fax(input, customname, customsender, 0) + + usr << "Message reply to transmitted successfully." + log_admin("[key_name(usr)] sent a Central Command fax message: [input]") + message_admins("[key_name_admin(usr)] sent a Central Command fax message: view message", 1) + +/client/proc/check_fax_history() + set name = "Check fax history" + set desc = "Look up the faxes sent this round." + set category = "Special Verbs" + + if (!check_rights(R_ADMIN|R_DUTYOFF|R_FUN)) + usr << "\red You do not have enough powers to do this." + return + + if (!ticker) + usr << "\red No ticker! Bad!" + return + + if (ticker.current_state < GAME_STATE_PLAYING) + usr << "\red The game hasn't started yet!" + return + + var/data = "
Send New Fax
" + data += "
" + data += "
Received Faxes:

" + var/list/faxes = ticker.fax_repository.get_subjects(1) + + for (var/i in faxes) + data += "[i]
" + + faxes = ticker.fax_repository.get_subjects(0) + + data += "
Sent Faxes:

" + for (var/i in faxes) + data += "[i]
" + + usr << browse("Centcomm Fax History[data]", "window=Centcomm Fax History")