From d1863ff7abead2bf5b646627c3b92f595ca58bfc Mon Sep 17 00:00:00 2001 From: Casey Date: Sun, 3 Jul 2022 12:14:33 -0400 Subject: [PATCH 1/2] Communicator Reply Messages --- .../items/devices/communicator/UI_tgui.dm | 4 +- .../items/devices/communicator/messaging.dm | 2 +- tgui/packages/tgui/components/Section.tsx | 2 +- .../{Communicator.js => Communicator.tsx} | 192 ++++++++++++++---- .../{CrewManifest.js => CrewManifest.tsx} | 11 +- .../tgui/interfaces/IdentificationComputer.js | 4 +- 6 files changed, 164 insertions(+), 51 deletions(-) rename tgui/packages/tgui/interfaces/{Communicator.js => Communicator.tsx} (87%) rename tgui/packages/tgui/interfaces/{CrewManifest.js => CrewManifest.tsx} (89%) diff --git a/code/game/objects/items/devices/communicator/UI_tgui.dm b/code/game/objects/items/devices/communicator/UI_tgui.dm index 34b0e845c2..f3f13663d8 100644 --- a/code/game/objects/items/devices/communicator/UI_tgui.dm +++ b/code/game/objects/items/devices/communicator/UI_tgui.dm @@ -85,7 +85,7 @@ cam_screen.vis_contents = visible_turfs cam_background.icon_state = "clear" cam_background.fill_rect(1, 1, (video_range * 2), (video_range * 2)) - + local_skybox.cut_overlays() local_skybox.add_overlay(SSskybox.get_skybox(get_z(last_camera_turf))) local_skybox.scale_to_view(video_range * 2) @@ -381,6 +381,8 @@ exonet.send_message(their_address, "text", text) im_list += list(list("address" = exonet.address, "to_address" = their_address, "im" = text)) log_pda("(COMM: [src]) sent \"[text]\" to [exonet.get_atom_from_address(their_address)]", usr) + var/obj/item/device/communicator/comm = exonet.get_atom_from_address(their_address) + to_chat(usr, "[bicon(src)] Sent message to [comm.owner], \"[text]\" (Reply)") for(var/mob/M in player_list) if(M.stat == DEAD && M.is_preference_enabled(/datum/client_preference/ghost_ears)) if(istype(M, /mob/new_player) || M.forbid_seeing_deadchat) diff --git a/code/game/objects/items/devices/communicator/messaging.dm b/code/game/objects/items/devices/communicator/messaging.dm index d7ac0e7824..bcfe1cf0c3 100644 --- a/code/game/objects/items/devices/communicator/messaging.dm +++ b/code/game/objects/items/devices/communicator/messaging.dm @@ -108,7 +108,7 @@ exonet.send_message(comm.exonet.address, "text", message) im_list += list(list("address" = exonet.address, "to_address" = comm.exonet.address, "im" = message)) log_pda("(COMM: [src]) sent \"[message]\" to [exonet.get_atom_from_address(comm.exonet.address)]", usr) - to_chat(usr, "[bicon(src)] Sent message to [comm.owner], \"[message]\"") + to_chat(usr, "[bicon(src)] Sent message to [comm.owner], \"[message]\" (Reply)") // Verb: text_communicator() // Parameters: None diff --git a/tgui/packages/tgui/components/Section.tsx b/tgui/packages/tgui/components/Section.tsx index 50ec8c8ff7..82d5f95d67 100644 --- a/tgui/packages/tgui/components/Section.tsx +++ b/tgui/packages/tgui/components/Section.tsx @@ -11,7 +11,7 @@ import { BoxProps, computeBoxClassName, computeBoxProps } from './Box'; interface SectionProps extends BoxProps { className?: string; - title?: string; + title?: string | InfernoElement; buttons?: InfernoNode; fill?: boolean; fitted?: boolean; diff --git a/tgui/packages/tgui/interfaces/Communicator.js b/tgui/packages/tgui/interfaces/Communicator.tsx similarity index 87% rename from tgui/packages/tgui/interfaces/Communicator.js rename to tgui/packages/tgui/interfaces/Communicator.tsx index 69805e26e9..6128f27038 100644 --- a/tgui/packages/tgui/interfaces/Communicator.js +++ b/tgui/packages/tgui/interfaces/Communicator.tsx @@ -1,4 +1,5 @@ import { filter } from 'common/collections'; +import { BooleanLike } from 'common/react'; import { decodeHtmlEntities, toTitleCase } from 'common/string'; import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; @@ -19,8 +20,30 @@ const SETTTAB = 9; let TabToTemplate = {}; // Populated under each template +type Data = { + // GENERAL + currentTab: number; + video_comm: BooleanLike; + mapRef: string; + + // FOOTER + time: string; + connectionStatus: BooleanLike; + owner: string; + occupation: string; + + // HEADER + flashlight: BooleanLike; + + // NOTIFICATIONS + voice_mobs: []; + communicating: []; + requestsReceived: []; + invitesSent: []; +}; + export const Communicator = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { currentTab, video_comm, mapRef } = data; @@ -54,7 +77,7 @@ export const Communicator = (props, context) => { }; const VideoComm = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { video_comm, mapRef } = data; @@ -164,7 +187,7 @@ const VideoComm = (props, context) => { }; const TemplateError = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { currentTab } = data; @@ -172,7 +195,7 @@ const TemplateError = (props, context) => { }; const CommunicatorHeader = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { time, connectionStatus, owner, occupation } = data; @@ -194,7 +217,7 @@ const CommunicatorHeader = (props, context) => { }; const CommunicatorFooter = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { flashlight } = data; @@ -245,7 +268,7 @@ const CommunicatorFooter = (props, context) => { /* Helper for notifications (yes this is a mess, but whatever, it works) */ const hasNotifications = (app, context) => { - const { data } = useBackend(context); + const { data } = useBackend(context); const { /* Phone Notifications */ @@ -267,9 +290,13 @@ const hasNotifications = (app, context) => { /* Tabs Below this point */ +type HomeTabData = { + homeScreen: { number: number; module: string; icon: string }[]; +}; + /* Home tab, provides access to all other tabs. */ const HomeTab = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { homeScreen } = data; @@ -305,9 +332,19 @@ const HomeTab = (props, context) => { TabToTemplate[HOMETAB] = ; +type PhoneTabData = { + targetAddress: string; + voice_mobs: { name: string; true_name: string; ref: string }[]; + communicating: { address: string; name: string; true_name: string; ref: string }[]; + requestsReceived: { address: string; name: string; ref: string }[]; + invitesSent: { address: string; name: string }[]; + video_comm: string; + selfie_mode: BooleanLike; +}; + /* Phone tab, provides a phone interface! */ const PhoneTab = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(context); const { targetAddress, voice_mobs, communicating, requestsReceived, invitesSent, video_comm, selfie_mode } = data; @@ -326,7 +363,7 @@ const PhoneTab = (props, context) => { -
+