Skip to content

Commit

Permalink
Makes faxes emaggable (#22969)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oblisk234 authored Jan 29, 2025
1 parent f8a9cb5 commit 9ab0636
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 31 deletions.
7 changes: 1 addition & 6 deletions _maps/RandomRuins/IceRuins/icemoon_surface_syndicate.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5413,12 +5413,6 @@
/turf/open/floor/plasteel/dark,
/area/ruin/syndicate_icemoon/xenobio)
"CP" = (
/obj/machinery/photocopier/faxmachine{
department = "Unidentified";
desc = "Used to send black pages to Nanotrasen stations.";
name = "Syndicate Fax Machine";
req_access = list("syndicate")
},
/obj/item/stamp/chameleon{
pixel_x = -6;
pixel_y = 10
Expand All @@ -5431,6 +5425,7 @@
/obj/effect/turf_decal/siding/wood{
dir = 9
},
/obj/machinery/photocopier/faxmachine/syndicate,
/turf/open/floor/wood,
/area/ruin/syndicate_icemoon/command)
"CQ" = (
Expand Down
7 changes: 1 addition & 6 deletions _maps/RandomRuins/SpaceRuins/listeningstation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2431,12 +2431,6 @@
/turf/open/floor/plasteel/dark,
/area/ruin/space/has_grav/listeningstation/hallway)
"KJ" = (
/obj/machinery/photocopier/faxmachine{
department = "Unidentified";
desc = "Used to send black pages to Nanotrasen stations.";
name = "Syndicate Fax Machine";
req_access = list("syndicate")
},
/obj/structure/table/reinforced,
/obj/effect/decal/cleanable/dirt,
/obj/effect/turf_decal/stripes/line{
Expand All @@ -2449,6 +2443,7 @@
dir = 1
},
/obj/effect/turf_decal/tile/red/fourcorners,
/obj/machinery/photocopier/faxmachine/syndicate,
/turf/open/floor/plasteel/dark,
/area/ruin/space/has_grav/listeningstation/hallway)
"KS" = (
Expand Down
1 change: 1 addition & 0 deletions _maps/map_files/generic/CentCom.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -21480,6 +21480,7 @@
dir = 9
},
/obj/structure/table/reinforced,
/obj/machinery/photocopier/faxmachine/syndicate_command,
/turf/open/floor/plasteel/dark,
/area/centcom/syndicate_mothership)
"crH" = (
Expand Down
11 changes: 6 additions & 5 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@
if(info)
info.examine(usr, TRUE)

else if(href_list["CentcomFaxReply"])
else if(href_list["AdminFaxReply"])
var/obj/machinery/photocopier/faxmachine/F = locate(href_list["originfax"]) in GLOB.allfaxes
if(!istype(F))
to_chat(src.owner, span_danger("Unable to locate fax!"))
Expand All @@ -1830,20 +1830,21 @@
send_admin_fax()

/client/proc/send_admin_fax(obj/machinery/photocopier/faxmachine/F)
var/inputsubject = input(src, "Please enter a subject", "Outgoing message from CentCom", "") as text|null
var/syndicate = (F?.obj_flags & EMAGGED)
var/inputsubject = input(src, "Please enter a subject", "Outgoing message from [syndicate ? "Syndicate" : "CentCom"]", "") as text|null
if(!inputsubject)
return

var/inputmessage = input(src, "Please enter the message sent to [istype(F) ? F : "all fax machines"] via secure connection. Supports pen markdown.", "Outgoing message from CentCom", "") as message|null
var/inputmessage = input(src, "Please enter the message sent to [istype(F) ? F : "all fax machines"] via secure connection. Supports pen markdown.", "Outgoing message from [syndicate ? "Syndicate" : "CentCom"]", "") as message|null
if(!inputmessage)
return

var/inputsigned = input(src, "Please enter CentCom Official name.", "Outgoing message from CentCom", usr?.client?.holder?.admin_signature || "") as text|null
var/inputsigned = input(src, "Please enter [syndicate ? "Syndicate" : "CentCom"] Official name.", "Outgoing message from [syndicate ? "Syndicate" : "CentCom"]", usr?.client?.holder?.admin_signature || "") as text|null
if(!inputsigned)
return

var/customname = input(src, "Pick a title for the report", "Title") as text|null
var/prefix = "<center><b>Nanotrasen Fax Network</b></center><hr><center>RE: [inputsubject]</center><hr>"
var/prefix = "<center><b>[syndicate ? "Syndicate" : "Nanotrasen"] Fax Network</b></center><hr><center>RE: [inputsubject]</center><hr>"
var/suffix = "<hr><b>Signed:</b> <font face=\"[SIGNFONT]\"><i>[inputsigned]</i></font>"

inputmessage = parsemarkdown(inputmessage)
Expand Down
63 changes: 49 additions & 14 deletions code/modules/paperwork/faxmachine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ GLOBAL_LIST_EMPTY(adminfaxes)
var/sendcooldown = 0 // to avoid spamming fax messages
var/department = "Unknown" // our department
var/destination = "Central Command" // the department we're sending to
var/hidefromfaxlist = FALSE // If enabled does not show up in the destination fax list

/obj/machinery/photocopier/faxmachine/Initialize(mapload)
. = ..()
if(hidefromfaxlist)
return
GLOB.allfaxes += src
if( !((department in GLOB.alldepartments) || (department in GLOB.admin_departments)) )
GLOB.alldepartments |= department
Expand All @@ -45,7 +48,7 @@ GLOBAL_LIST_EMPTY(adminfaxes)
.["has_copy"] = !copier_empty()
.["copy_name"] = copy?.name || photocopy?.name || doccopy?.name
.["cooldown"] = sendcooldown - world.time
.["depts"] = (GLOB.alldepartments + GLOB.admin_departments)
.["depts"] = obj_flags & EMAGGED ? (GLOB.alldepartments + GLOB.admin_departments + list("Syndicate")) : (GLOB.alldepartments + GLOB.admin_departments)
.["destination"] = destination

/obj/machinery/photocopier/faxmachine/ui_act(action, list/params)
Expand All @@ -62,6 +65,8 @@ GLOBAL_LIST_EMPTY(adminfaxes)
sendcooldown = world.time + 1 MINUTES
if (destination in GLOB.admin_departments)
INVOKE_ASYNC(src, PROC_REF(send_admin_fax), usr, destination)
if (destination == "Syndicate")
INVOKE_ASYNC(src, PROC_REF(send_admin_fax), usr, destination)
else
INVOKE_ASYNC(src, PROC_REF(sendfax), destination)
return
Expand Down Expand Up @@ -91,6 +96,10 @@ GLOBAL_LIST_EMPTY(adminfaxes)
authenticated = TRUE
auth_name = usr.client.holder.admin_signature
return
if(obj_flags & EMAGGED)
authenticated = TRUE
auth_name = "$#%*! - ERROR"
return
var/obj/item/card/id/id_card = usr.get_idcard(hand_first = TRUE)
if (check_access(id_card))
authenticated = TRUE
Expand Down Expand Up @@ -163,13 +172,11 @@ GLOBAL_LIST_EMPTY(adminfaxes)
F.recievefax(rcvdcopy)

//message badmins that a fax has arrived
switch(destination)
if ("Central Command")
for(var/client/C in GLOB.permissions.admins) //linked to prayers cause we are running out of legacy toggles
if(C.prefs.chat_toggles & CHAT_PRAYER_N_FAX) //if to be moved elsewhere then we must declutter legacy toggles
if(C.prefs.toggles & SOUND_PRAYER_N_FAX)//if done then delete these comments
SEND_SOUND(sender, sound('sound/effects/admin_fax.ogg'))
send_adminmessage(sender, "CENTCOM FAX", rcvdcopy, "CentcomFaxReply", "#006100")
for(var/client/C in GLOB.permissions.admins) //linked to prayers cause we are running out of legacy toggles
if(C.prefs.chat_toggles & CHAT_PRAYER_N_FAX) //if to be moved elsewhere then we must declutter legacy toggles
if(C.prefs.toggles & SOUND_PRAYER_N_FAX)//if done then delete these comments
SEND_SOUND(sender, sound('sound/effects/admin_fax.ogg'))
send_adminmessage(sender, destination == "Syndicate" ? "SYNDICATE FAX" : "CENTCOM FAX", rcvdcopy, "AdminFaxReply", destination == "Syndicate" ? "crimson" : "#006100")
sendcooldown = world.time + 1 MINUTES
sleep(5 SECONDS)
visible_message("[src] beeps, \"Message transmitted successfully.\"")
Expand All @@ -194,7 +201,8 @@ GLOBAL_LIST_EMPTY(adminfaxes)
// give the sprite some time to flick
spawn(20)
var/obj/item/paper/P = new /obj/item/paper( loc )
P.name = "[command_name()] - [customname]"
var/syndicate = obj_flags & EMAGGED
P.name = syndicate ? "The Syndicate - [customname]" : "[command_name()] - [customname]"

var/list/templist = list() // All the stuff we're adding to $written
for(var/text in T)
Expand All @@ -212,19 +220,46 @@ GLOBAL_LIST_EMPTY(adminfaxes)
var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/simple/paper)
if (isnull(P.stamps))
P.stamps = sheet.css_tag()
P.stamps += sheet.icon_tag("stamp-cent")
P.stamps += "<br><i>This paper has been verified by the Central Command Quantum Relay.</i><br>"
var/mutable_appearance/stampoverlay = mutable_appearance('icons/obj/bureaucracy.dmi', "paper_stamp-cent")
P.stamps += syndicate ? sheet.icon_tag("stamp-syndiround") : sheet.icon_tag("stamp-cent")
P.stamps += "<br><i>This paper has [syndicate ? "not" : ""] been verified by the Central Command Quantum Relay.</i><br>"
var/mutable_appearance/stampoverlay = mutable_appearance('icons/obj/bureaucracy.dmi', syndicate ? "paper_stamp-syndiround" : "paper_stamp-cent")
stampoverlay.pixel_x = rand(-2, 2)
stampoverlay.pixel_y = rand(-3, 2)

LAZYADD(P.stamped, "stamp-cent")
LAZYADD(P.stamped, syndicate ? "stamp-syndiround" : "stamp-cent")
P.add_overlay(stampoverlay)

/obj/machinery/photocopier/faxmachine/AltClick(mob/user)
if(IsAdminGhost(user))
send_admin_fax(src)
send_admin_fax(src)

/obj/machinery/photocopier/faxmachine/examine(mob/user)
. = ..()
if(IsAdminGhost(user))
.+= span_notice("You can send admin faxes via Alt-Click to this specific fax machine.")

/obj/machinery/photocopier/faxmachine/emag_act(mob/user, /obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
to_chat(user, span_warning("[src]'s transceiver is damaged!"))
return FALSE
obj_flags |= EMAGGED
playsound(src, "sparks", 100, 1)
to_chat(user, span_warning("You short out the security protocols on [src]'s transceiver!"))
return TRUE

///Common syndicate fax machines, comes pre-emagged
/obj/machinery/photocopier/faxmachine/syndicate
department = "Unidentified"
desc = "Used to send black pages to Nanotrasen stations."
name = "Syndicate Fax Machine"
obj_flags = CAN_BE_HIT | EMAGGED
req_access = list(ACCESS_SYNDICATE)

///The fax machine in the Syndicate mothership
/obj/machinery/photocopier/faxmachine/syndicate_command
department = "Syndicate"
desc = "Used for communication between the different echelons of the Syndicate. It has a note on the side reading <i>'DO NOT MOVE'</i>."
destination = "Bridge"
hidefromfaxlist = TRUE
name = "Syndicate Fax Machine"
req_access = list(ACCESS_SYNDICATE)

0 comments on commit 9ab0636

Please sign in to comment.