Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TM] Fax panel hotfix #1654

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2344,16 +2344,7 @@
P.stamp_overlays += stampoverlay
P.stamps += "<hr><img src='large_stamp-[stampvalue].png'>"
P.update_icon()

var/datum/fax/admin/sending = new /datum/fax/admin()
sending.name = P.name
sending.to_department = fax.department
sending.origin = "Administrator"
sending.message = P
sending.sent_by = usr
sending.sent_at = world.time

fax.receivefax(sending)
fax.receivefax(P)
if(istype(H) && H.stat == CONSCIOUS && (istype(H.l_ear, /obj/item/radio/headset) || istype(H.r_ear, /obj/item/radio/headset)))
to_chat(H, "<span class='specialnotice bold'>Your headset pings, notifying you that a reply to your fax has arrived.</span>")
to_chat(src.owner, "You sent a standard '[stype]' fax to [H]")
Expand Down Expand Up @@ -2556,30 +2547,29 @@
P.stamp_overlays += stampoverlay
P.stamps += "<hr><i>[stampvalue]</i>"

var/datum/fax/admin/sending = new /datum/fax/admin()
sending.name = P.name
sending.from_department = faxtype
if(destination != "All Departments")
sending.to_department = fax.department
else
sending.to_department = "All Departments"
sending.origin = "Administrator"
sending.message = P
sending.reply_to = reply_to
sending.sent_by = usr
sending.sent_at = world.time

if(destination != "All Departments")
if(!fax.receivefax(sending))
if(!fax.receivefax(P))
to_chat(src.owner, "<span class='warning'>Message transmission failed.</span>")
return
else
for(var/obj/machinery/photocopier/faxmachine/F in GLOB.allfaxes)
if(is_station_level(F.z))
spawn(0)
if(!F.receivefax(sending))
if(!F.receivefax(P))
to_chat(src.owner, "<span class='warning'>Message transmission to [F.department] failed.</span>")

var/datum/fax/admin/A = new /datum/fax/admin()
A.name = P.name
A.from_department = faxtype
if(destination != "All Departments")
A.to_department = fax.department
else
A.to_department = "All Departments"
A.origin = "Administrator"
A.message = P
A.reply_to = reply_to
A.sent_by = usr
A.sent_at = world.time

to_chat(src.owner, "<span class='notice'>Message transmitted successfully.</span>")
if(notify == "Yes")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/paperwork/fax.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GLOBAL_LIST_EMPTY(adminfaxes)
var/list/reply_to = null

/datum/fax/admin/New()
return
GLOB.adminfaxes += src

// Fax panel - lets admins check all faxes sent during the round
/client/proc/fax_panel()
Expand Down
53 changes: 19 additions & 34 deletions code/modules/paperwork/faxmachine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -299,22 +299,22 @@ GLOBAL_LIST_EMPTY(fax_blacklist)
var/success = 0
for(var/obj/machinery/photocopier/faxmachine/F in GLOB.allfaxes)
if(F.department == destination)
var/datum/fax/A = new /datum/fax()
A.name = copyitem.name
A.from_department = department
A.to_department = destination
A.origin = src
A.message = copyitem
A.sent_by = sender
A.sent_at = world.time

success = F.receivefax(A)
success = F.receivefax(copyitem)
if(success)
var/datum/fax/F = new /datum/fax()
F.name = copyitem.name
F.from_department = department
F.to_department = destination
F.origin = src
F.message = copyitem
F.sent_by = sender
F.sent_at = world.time

visible_message("[src] beeps, \"Message transmitted successfully.\"")
else
visible_message("[src] beeps, \"Error transmitting message.\"")

/obj/machinery/photocopier/faxmachine/proc/receivefax(datum/fax/incoming)
/obj/machinery/photocopier/faxmachine/proc/receivefax(obj/item/incoming)
if(stat & (BROKEN|NOPOWER))
return FALSE

Expand All @@ -327,31 +327,16 @@ GLOBAL_LIST_EMPTY(fax_blacklist)
addtimer(CALLBACK(src, PROC_REF(print_fax), incoming), 2 SECONDS)
return TRUE

/obj/machinery/photocopier/faxmachine/proc/print_fax(datum/fax/incoming)
var/obj/item/new_copy = null
if(istype(incoming.message, /obj/item/paper))
new_copy = papercopy(incoming.message)
else if(istype(incoming.message, /obj/item/photo))
new_copy = photocopy(incoming.message)
else if(istype(incoming.message, /obj/item/paper_bundle))
new_copy = bundlecopy(incoming.message)
/obj/machinery/photocopier/faxmachine/proc/print_fax(obj/item/incoming)
if(istype(incoming, /obj/item/paper))
papercopy(incoming)
else if(istype(incoming, /obj/item/photo))
photocopy(incoming)
else if(istype(incoming, /obj/item/paper_bundle))
bundlecopy(incoming)
else
return

// Store the fax that was received in the admin room in adminfaxes
// Fixes issue where deleting the original would make it unreadable in the admin panel
if(istype(incoming, /datum/fax/admin))
var/datum/fax/admin/A = new /datum/fax/admin()
A.name = new_copy.name
A.from_department = incoming.from_department
A.to_department = incoming.to_department
A.origin = incoming.origin
A.message = new_copy
A.sent_by = incoming.sent_by
A.sent_at = incoming.sent_at

GLOB.adminfaxes += A

use_power(active_power_consumption)

/obj/machinery/photocopier/faxmachine/proc/log_fax(mob/sender, destination)
Expand Down Expand Up @@ -402,7 +387,7 @@ GLOBAL_LIST_EMPTY(fax_blacklist)
message_admins(sender, "SYNDICATE FAX", destination, copyitem, "#DC143C")
for(var/obj/machinery/photocopier/faxmachine/F in GLOB.allfaxes)
if(F.department == destination)
F.receivefax(A)
F.receivefax(copyitem)
visible_message("[src] beeps, \"Message transmitted successfully.\"")
log_fax(sender, destination)

Expand Down
Loading