From d69bb900c6de9c0d03880bc54a5e020fe77dd8cc Mon Sep 17 00:00:00 2001
From: Kocma-san <112967882+Kocma-san@users.noreply.github.com>
Date: Sun, 22 Dec 2024 04:29:13 +0700
Subject: [PATCH] enhancements for fax requests in request manager (#88391)
## About The Pull Request
Addition to [#84910](https://github.com/tgstation/tgstation/pull/84910)
Added a "print" button to the request manager. It simply prints at the
centcom station the paper that was faxed to the admins.
Also added "Auto-print Faxes" button to the request manager, which
allows you to enable automatic printing of requests on the admin fax
Screenshots



## Why It's Good For The Game
The message in the chat may get lost. In this case, it will no longer be
possible to print the paper sent to the CC
Changing the allow_exotic_faxes variable will allow you to fax something
unusual to the station in (very rare) situations. No need to manually
change this variable
## Changelog
:cl:
add: added a "print" button to the request manager
add: admin fax can now send exotic items
add: added "Auto-print Faxes" button to the request manager, which
allows you to enable automatic printing of requests on the admin fax
fix: fixed a bug where pressing the print button would cause the receive
animation to appear on all admin faxes.
/:cl:
---
code/modules/admin/topic.dm | 2 +-
code/modules/paperwork/fax.dm | 11 ++++++++++-
code/modules/requests/request_manager.dm | 18 +++++++++++++++++-
.../tgui/interfaces/RequestManager.tsx | 18 +++++++++++++++++-
4 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 6a2666eef9b..f517a7a7a51 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1731,7 +1731,7 @@
if(FAX.fax_id != href_list["destination"])
continue
FAX.receive(locate(href_list["print_fax"]), href_list["sender_name"])
-
+ return
else if(href_list["play_internet"])
if(!check_rights(R_SOUND))
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index f2935853a6d..62a269d477e 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -1,4 +1,5 @@
GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department", "NT Complaint Department", "NT Customer Relations", "Nanotrasen Tech Support", "NT Internal Affairs Dept"))
+GLOBAL_VAR_INIT(fax_autoprinting, FALSE)
/obj/machinery/fax
name = "Fax Machine"
@@ -325,7 +326,7 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department
history_add("Send", params["name"])
- GLOB.requests.fax_request(usr.client, "sent a fax message from [fax_name]/[fax_id] to [params["name"]]", fax_paper)
+ GLOB.requests.fax_request(usr.client, "sent a fax message from [fax_name]/[fax_id] to [params["name"]]", list("paper" = fax_paper, "destination_id" = params["id"], "sender_name" = fax_name))
to_chat(GLOB.admins,
span_adminnotice("[icon2html(src.icon, GLOB.admins)]FAX REQUEST: [ADMIN_FULLMONTY(usr)]: [span_linkify("sent a fax message from [fax_name]/[fax_id][ADMIN_FLW(src)] to [html_encode(params["name"])]")] [ADMIN_SHOW_PAPER(fax_paper)] [ADMIN_PRINT_FAX(fax_paper, fax_name, params["id"])]"),
type = MESSAGE_TYPE_PRAYER,
@@ -333,6 +334,14 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department
for(var/client/staff as anything in GLOB.admins)
if(staff?.prefs.read_preference(/datum/preference/toggle/comms_notification))
SEND_SOUND(staff, sound('sound/misc/server-ready.ogg'))
+
+ if(GLOB.fax_autoprinting)
+ for(var/obj/machinery/fax/admin/FAX as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/fax/admin))
+ if(FAX.fax_id != params["id"])
+ continue
+ FAX.receive(fax_paper, fax_name)
+ break
+
log_fax(fax_paper, params["id"], params["name"])
loaded_item_ref = null
update_appearance()
diff --git a/code/modules/requests/request_manager.dm b/code/modules/requests/request_manager.dm
index 99a9bba1cc8..3106a925acd 100644
--- a/code/modules/requests/request_manager.dm
+++ b/code/modules/requests/request_manager.dm
@@ -154,6 +154,10 @@ GLOBAL_DATUM_INIT(requests, /datum/request_manager, new)
to_chat(usr, "You do not have permission to do this, you require +ADMIN", confidential = TRUE)
return
+ if (action == "toggleprint")
+ GLOB.fax_autoprinting = !GLOB.fax_autoprinting
+ return TRUE
+
// Get the request this relates to
var/id = params["id"] != null ? text2num(params["id"]) : null
if (!id)
@@ -228,9 +232,20 @@ GLOBAL_DATUM_INIT(requests, /datum/request_manager, new)
if(request.req_type != REQUEST_FAX)
to_chat(usr, "Request doesn't have a paper to read.", confidential = TRUE)
return TRUE
- var/obj/item/paper/request_message = request.additional_information
+ var/obj/item/paper/request_message = request.additional_information["paper"]
request_message.ui_interact(usr)
return TRUE
+ if ("print")
+ if (request.req_type != REQUEST_FAX)
+ to_chat(usr, "Request doesn't have a paper to print.", confidential = TRUE)
+ return TRUE
+ for(var/obj/machinery/fax/admin/FAX as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/fax/admin))
+ if(FAX.fax_id != request.additional_information["destination_id"])
+ continue
+ var/obj/item/paper/request_message = request.additional_information["paper"]
+ var/sender_name = request.additional_information["sender_name"]
+ FAX.receive(request_message, sender_name)
+ return TRUE
if ("play")
if(request.req_type != REQUEST_INTERNET_SOUND)
to_chat(usr, "Request doesn't have a sound to play.", confidential = TRUE)
@@ -257,6 +272,7 @@ GLOBAL_DATUM_INIT(requests, /datum/request_manager, new)
"timestamp" = request.timestamp,
"timestamp_str" = gameTimestamp(wtime = request.timestamp)
))
+ data["fax_autoprinting"] = GLOB.fax_autoprinting
return data
#undef REQUEST_PRAYER
diff --git a/tgui/packages/tgui/interfaces/RequestManager.tsx b/tgui/packages/tgui/interfaces/RequestManager.tsx
index 9a009106788..5bc63512f3f 100644
--- a/tgui/packages/tgui/interfaces/RequestManager.tsx
+++ b/tgui/packages/tgui/interfaces/RequestManager.tsx
@@ -3,6 +3,7 @@
* @copyright 2021 bobbahbrown (https://github.com/bobbahbrown)
* @license MIT
*/
+import { BooleanLike } from 'common/react';
import { createSearch, decodeHtmlEntities } from 'common/string';
import { useState } from 'react';
@@ -12,6 +13,7 @@ import { Window } from '../layouts';
type Data = {
requests: Request[];
+ fax_autoprinting: BooleanLike;
};
type Request = {
@@ -72,6 +74,15 @@ export const RequestManager = (props) => {
buttons={
+ act('toggleprint')}
+ tooltip={
+ 'Enables automatic printing of fax requests to the admin fax machine. By default, this fax is located in the briefing room at the central command station'
+ }
+ >
+ Auto-print Faxes
+
setSearchText(value)}
@@ -146,7 +157,12 @@ const RequestControls = (props) => {
)}
{request.req_type === 'request_fax' && (
-
+ <>
+
+
+ >
)}
{request.req_type === 'request_internet_sound' && (