From 6d2511c996e0a943bb1f0dfea23eb12bc276aee6 Mon Sep 17 00:00:00 2001 From: Runa Dacino Date: Fri, 4 Aug 2023 16:25:38 +0200 Subject: [PATCH] adds: ability to make automated staff request in fax TGUI Adds a new jsx element to the login screen when using fax machines, a button in the top right corner which when pushed calls the request_roles() verb, and thus initiates the auto fax dialogue for the player. This element has a tooltip to explain what it does when hovered. Furthermore, for when EITHER the fax machine has an ID && logged in, BUT no paper is inserted OR paper is inserted && target destination is part of admin_departments (centcom, job board, supply) - it displays a blurb about automated staff requests with some semi-IC, semi-OOC text and the same button. adds a new general functionality to LoginScreen.js Adds a new JSX element to the LoginScreen file that takes machine type as its prop and returns a per-machine relevant element. This is needed for the fax functionality, and already has it defined. --- code/modules/paperwork/faxmachine.dm | 5 +- tgui/packages/tgui/interfaces/Fax.js | 53 +++++++++++++++++-- .../tgui/interfaces/common/LoginScreen.js | 36 +++++++++++++ tgui/public/tgui.bundle.js | 2 +- 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index fc284377bba..1e16e3c4533 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -51,10 +51,10 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins return if(L.stat || L.restrained()) return - if(!scan) to_chat(L, span_notice("There is no I.D card to remove!")) return + scan.forceMove(loc) if(ishuman(usr) && !usr.get_active_hand()) usr.put_in_hands(scan) @@ -154,6 +154,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins data["rank"] = rank data["isAI"] = isAI(user) data["isRobot"] = isrobot(user) + data["adminDepartments"] = admin_departments data["bossName"] = using_map.boss_name data["copyItem"] = copyitem @@ -211,6 +212,8 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins usr.put_in_hands(copyitem) to_chat(usr, "You take \the [copyitem] out of \the [src].") copyitem = null + if("send_automated_staff_request") + request_roles() if(!authenticated) return diff --git a/tgui/packages/tgui/interfaces/Fax.js b/tgui/packages/tgui/interfaces/Fax.js index acd19b61897..86d8ea29820 100644 --- a/tgui/packages/tgui/interfaces/Fax.js +++ b/tgui/packages/tgui/interfaces/Fax.js @@ -7,21 +7,26 @@ import { LoginScreen } from './common/LoginScreen'; export const Fax = (props, context) => { const { data } = useBackend(context); - const { authenticated } = data; + const { authenticated, copyItem } = data; + + let variableHeight = 340; + if (copyItem) { + variableHeight = 358; + } if (!authenticated) { return ( - + ); } return ( - + @@ -34,7 +39,8 @@ export const Fax = (props, context) => { export const FaxContent = (props, context) => { const { act, data } = useBackend(context); - const { bossName, copyItem, cooldown, destination } = data; + const { bossName, copyItem, cooldown, destination, adminDepartments } = data; + const staffRequestDepartment = new Set(adminDepartments); return (
@@ -48,6 +54,7 @@ export const FaxContent = (props, context) => { {bossName} Quantum Entanglement Network + {(copyItem && ( @@ -70,6 +77,7 @@ export const FaxContent = (props, context) => { /> )) || Please insert item to transmit.} +
); }; @@ -94,3 +102,40 @@ const RemoveItem = (props, context) => { ); }; + +const AutomatedStaffRequest = (props, context) => { + const { act, data } = useBackend(context); + + const { adminDepartments, destination, copyItem } = data; + const staffRequestDepartment = new Set(adminDepartments); + + let flexiblePadding = '1rem'; + if (copyItem) { + flexiblePadding = '1.5rem'; + } + + if (!copyItem || (copyItem && staffRequestDepartment.has(destination))) { + return ( + + Or submit an automated staff request.

+ + The automated staff request form automatically populates the company + job board ((sends to discord, but does not ping.)) without requiring + intervention from central command clerks and officers.
+ It also works without requiring a written request to be composed. +
+
+ +