From 4948dafe7ee81fb5d25bc2fe7e5441775de8f724 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 8 May 2023 23:09:17 +0100 Subject: [PATCH] [MIRROR] Request Console refactor [MDB IGNORE] (#20979) * Request Console refactor * wew * wew --------- Co-authored-by: Profakos Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com> --- _maps/map_files/Birdshot/birdshot.dmm | 36 +- .../map_files/Deltastation/DeltaStation2.dmm | 50 +- .../map_files/IceBoxStation/IceBoxStation.dmm | 40 +- _maps/map_files/MetaStation/MetaStation.dmm | 40 +- _maps/map_files/NorthStar/north_star.dmm | 44 +- _maps/map_files/VoidRaptor/VoidRaptor.dmm | 44 +- _maps/map_files/generic/CentCom.dmm | 4 +- _maps/map_files/tramstation/tramstation.dmm | 58 +- code/__DEFINES/radio.dm | 6 + code/datums/request_message.dm | 57 ++ code/game/machinery/requests_console.dm | 548 +++++++----------- .../telecomms/machines/message_server.dm | 8 +- code/modules/admin/verbs/debug.dm | 2 +- code/modules/mining/machine_redemption.dm | 22 +- tgstation.dme | 1 + .../RequestsConsole/AnnouncementTab.tsx | 72 +++ .../RequestsConsole/MessageViewTab.tsx | 83 +++ .../RequestsConsole/MessageWriteTab.tsx | 204 +++++++ .../RequestsConsole/RequestsConsoleHeader.tsx | 91 +++ .../RequestsConsoleMainScreen.tsx | 64 ++ .../tgui/interfaces/RequestsConsole/index.tsx | 46 ++ .../tgui/interfaces/RequestsConsole/types.ts | 55 ++ .../Scripts/75067_request_console_cleanup.txt | 1 + 23 files changed, 1087 insertions(+), 489 deletions(-) create mode 100644 code/datums/request_message.dm create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/AnnouncementTab.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/MessageViewTab.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/MessageWriteTab.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/RequestsConsoleHeader.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/RequestsConsoleMainScreen.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/index.tsx create mode 100644 tgui/packages/tgui/interfaces/RequestsConsole/types.ts create mode 100644 tools/UpdatePaths/Scripts/75067_request_console_cleanup.txt diff --git a/_maps/map_files/Birdshot/birdshot.dmm b/_maps/map_files/Birdshot/birdshot.dmm index a41ed725c33..ca0f513973d 100644 --- a/_maps/map_files/Birdshot/birdshot.dmm +++ b/_maps/map_files/Birdshot/birdshot.dmm @@ -13875,10 +13875,10 @@ }, /obj/effect/decal/cleanable/cobweb, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; department = "Chief Engineer's Desk"; - name = "Chief Engineer's Requests Console" + name = "Chief Engineer's Requests Console"; + can_send_announcements = 1 }, /obj/machinery/camera/autoname/directional/north, /turf/open/floor/iron/dark, @@ -21893,11 +21893,11 @@ pixel_y = 5 }, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Personnel's Desk"; - name = "Head of Personnel's Requests Console" + name = "Head of Personnel's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/plating, /area/station/command/heads_quarters/hop) @@ -24824,11 +24824,11 @@ /area/station/cargo/miningoffice) "jik" = ( /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Chief Medical Officer's Desk"; - name = "Chief Medical Officer's Requests Console" + name = "Chief Medical Officer's Requests Console"; + can_send_announcements = 1 }, /obj/machinery/atmospherics/components/unary/vent_pump/on/layer4{ dir = 1 @@ -26569,13 +26569,13 @@ dir = 1 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Captain's Desk"; name = "Captain's Requests Console"; pixel_x = 0; - pixel_y = -30 + pixel_y = -30; + can_send_announcements = 1 }, /turf/open/floor/wood/large, /area/station/command/heads_quarters/captain) @@ -35096,10 +35096,10 @@ /obj/machinery/light/cold/directional/south, /obj/structure/sign/poster/official/random/directional/south, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/qm) @@ -36613,11 +36613,11 @@ dir = 8 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Director's Desk"; - name = "Research Director's Requests Console" + name = "Research Director's Requests Console"; + can_send_announcements = 1 }, /obj/effect/turf_decal/siding/purple{ dir = 6 @@ -62310,12 +62310,12 @@ pixel_y = -16 }, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Lab"; name = "Research Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /turf/open/floor/iron/white/small, /area/station/science/lab) @@ -69207,11 +69207,11 @@ pixel_y = 4 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; - name = "Bridge Requests Console" + name = "Bridge Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/smooth, /area/station/command/bridge) @@ -69588,11 +69588,11 @@ /obj/effect/decal/cleanable/cobweb, /obj/machinery/light/small/directional/west, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Security's Desk"; - name = "Head of Security Requests Console" + name = "Head of Security Requests Console"; + can_send_announcements = 1 }, /obj/machinery/camera/autoname/directional/west, /turf/open/floor/stone, diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index 8588b81a04e..f4b3d042dcb 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -20536,12 +20536,12 @@ /area/station/service/abandoned_gambling_den/gaming) "fem" = ( /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Director's Desk"; name = "Research Director's Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /obj/item/kirbyplants/dead, /obj/machinery/light/directional/west, @@ -24097,11 +24097,11 @@ /obj/machinery/photocopier, /obj/machinery/light/directional/north, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Security's Desk"; - name = "Head of Security's Requests Console" + name = "Head of Security's Requests Console"; + can_send_announcements = 1 }, /obj/structure/sign/nanotrasen{ pixel_x = 32; @@ -28753,12 +28753,12 @@ dir = 6 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Lab"; name = "Research Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /obj/machinery/camera/directional/east{ c_tag = "Science - Research and Development"; @@ -29602,11 +29602,11 @@ "hrK" = ( /obj/structure/cable, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; assistance_requestable = 1; department = "Chief Engineer's Desk"; name = "Chief Engineer's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/machinery/camera/directional/west{ c_tag = "Engineering - Chief Engineer's Office"; @@ -35478,11 +35478,11 @@ /obj/structure/table/wood, /obj/structure/window/reinforced/spawner/directional/west, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; - name = "Bridge Requests Console" + name = "Bridge Requests Console"; + can_send_announcements = 1 }, /obj/item/papercutter, /turf/open/floor/iron/grimy, @@ -40128,11 +40128,11 @@ dir = 1 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Chief Medical Officer's Desk"; - name = "Chief Medical Officer's Requests Console" + name = "Chief Medical Officer's Requests Console"; + can_send_announcements = 1 }, /obj/machinery/light_switch/directional/west, /obj/effect/turf_decal/tile/neutral/half/contrasted{ @@ -72265,11 +72265,11 @@ dir = 4 }, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Captain's Desk"; - name = "Captain's Requests Console" + name = "Captain's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/carpet, /area/station/command/heads_quarters/captain) @@ -75070,10 +75070,10 @@ "sNp" = ( /obj/machinery/light/directional/east, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/structure/filingcabinet/chestdrawer, /obj/effect/turf_decal/tile/brown/anticorner/contrasted, @@ -80378,11 +80378,25 @@ /obj/item/paper_bin/carbon, /obj/item/stamp/hop, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Personnel's Desk"; - name = "Head of Personnel's Requests Console" + name = "Head of Personnel's Requests Console"; + can_send_announcements = 1 + }, +/obj/merge_conflict_marker{ + name = "---Merge Conflict Marker---"; + desc = "A best-effort merge was performed. You must resolve this conflict yourself (manually) and remove this object once complete." + }, +/obj/structure/table/wood, +/obj/item/paper_bin/carbon, +/obj/item/stamp/head/hop, +/obj/machinery/requests_console/directional/north{ + anon_tips_receiver = 1; + assistance_requestable = 1; + department = "Head of Personnel's Desk"; + name = "Head of Personnel's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/hop) diff --git a/_maps/map_files/IceBoxStation/IceBoxStation.dmm b/_maps/map_files/IceBoxStation/IceBoxStation.dmm index 9302048319a..d2c2168827f 100644 --- a/_maps/map_files/IceBoxStation/IceBoxStation.dmm +++ b/_maps/map_files/IceBoxStation/IceBoxStation.dmm @@ -6501,11 +6501,11 @@ /obj/structure/table/glass, /obj/machinery/light/directional/north, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Chief Medical Officer's Desk"; - name = "Chief Medical Officer's Requests Console" + name = "Chief Medical Officer's Requests Console"; + can_send_announcements = 1 }, /obj/item/toy/figure/cmo{ pixel_x = -17; @@ -28535,11 +28535,11 @@ /area/station/tcommsat/computer) "jen" = ( /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Telecomms Admin"; - name = "Telecomms Requests Console" + name = "Telecomms Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron, /area/station/tcommsat/computer) @@ -28861,11 +28861,11 @@ /area/station/science/explab) "jkQ" = ( /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Personnel's Desk"; - name = "Head of Personnel's Requests Console" + name = "Head of Personnel's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron, /area/station/command/heads_quarters/hop) @@ -40517,11 +40517,11 @@ "mZe" = ( /obj/structure/filingcabinet, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Captain's Desk"; - name = "Captain's Requests Console" + name = "Captain's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/captain) @@ -41367,11 +41367,11 @@ "nlz" = ( /obj/machinery/computer/security/hos, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Security's Desk"; - name = "Head of Security Requests Console" + name = "Head of Security Requests Console"; + can_send_announcements = 1 }, /obj/machinery/button/door/directional/north{ id = "hosspace"; @@ -42031,11 +42031,11 @@ "nuH" = ( /obj/machinery/computer/security/qm, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; assistance_requestable = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Desk Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/brown/anticorner/contrasted{ dir = 1 @@ -53987,12 +53987,12 @@ /area/mine/eva/lower) "rgx" = ( /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Director's Desk"; name = "Research Director's Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /obj/machinery/pdapainter/research, /turf/open/floor/iron/white, @@ -64238,11 +64238,11 @@ dir = 4 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; - name = "Bridge Requests Console" + name = "Bridge Requests Console"; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/blue/half/contrasted, /turf/open/floor/iron, @@ -64746,11 +64746,11 @@ c_tag = "Chief Engineer's Office" }, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; assistance_requestable = 1; department = "Chief Engineer's Desk"; name = "Chief Engineer's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/neutral/fourcorners, /turf/open/floor/iron/dark, @@ -75856,11 +75856,11 @@ /obj/machinery/light/directional/south, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; - name = "Bridge Requests Console" + name = "Bridge Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/meeting_room) diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index bc35e866b6b..3c6ee444697 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -214,11 +214,11 @@ }, /obj/machinery/keycard_auth/directional/west, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Head of Security's Desk"; name = "Head of Security Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/machinery/button/door/directional/north{ id = "hosspace"; @@ -664,11 +664,11 @@ /area/space/nearstation) "aoE" = ( /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Bridge"; name = "Bridge Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/machinery/computer/cargo/request, /obj/structure/cable, @@ -6271,11 +6271,11 @@ }, /obj/machinery/light/small/directional/east, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Captain's Desk"; name = "Captain's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/captain/private) @@ -31224,11 +31224,11 @@ dir = 5 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Research Director's Desk"; name = "Research Director's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/iron/white, /area/station/command/heads_quarters/rd) @@ -36727,11 +36727,11 @@ pixel_y = 2 }, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Head of Personnel's Desk"; name = "Head of Personnel's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/hop) @@ -39152,12 +39152,12 @@ /obj/structure/table, /obj/machinery/cell_charger, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Research Lab"; name = "Research Requests Console"; receive_ore_updates = 1; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/iron, /area/station/science/lab) @@ -40133,11 +40133,11 @@ }, /obj/structure/table/wood, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; department = "Telecomms Admin"; name = "Telecomms Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/iron/grimy, /area/station/tcommsat/computer) @@ -46144,11 +46144,11 @@ dir = 4 }, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; department = "Chief Medical Officer's Desk"; name = "Chief Medical Officer's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/blue/half/contrasted{ dir = 8 @@ -51127,10 +51127,10 @@ "suJ" = ( /obj/structure/table/wood/fancy/orange, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/item/reagent_containers/cup/glass/bottle/whiskey{ pixel_x = -5; @@ -54950,10 +54950,10 @@ "tKS" = ( /obj/machinery/modular_computer/console/preset/id, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Chief Engineer's Desk"; name = "Chief Engineer's Requests Console"; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/neutral/fourcorners, /turf/open/floor/iron/dark, diff --git a/_maps/map_files/NorthStar/north_star.dmm b/_maps/map_files/NorthStar/north_star.dmm index 9b0a14ad628..d39c48b966c 100644 --- a/_maps/map_files/NorthStar/north_star.dmm +++ b/_maps/map_files/NorthStar/north_star.dmm @@ -3214,12 +3214,12 @@ }, /obj/effect/turf_decal/bot, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Lab"; name = "Research Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /turf/open/floor/iron/dark, /area/station/science/lab) @@ -4885,11 +4885,11 @@ /obj/structure/bed/dogbed/lia, /mob/living/basic/carp/pet/lia, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Security's Desk"; - name = "Head of Security Requests Console" + name = "Head of Security Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/hos) @@ -31966,10 +31966,10 @@ /obj/structure/bed/double/pod, /obj/item/bedsheet/qm/double, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /turf/open/floor/carpet/orange, /area/station/command/heads_quarters/qm) @@ -33354,11 +33354,11 @@ /obj/item/storage/box/silver_ids, /obj/machinery/camera/autoname/directional/north, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Personnel's Desk"; - name = "Head of Personnel's Requests Console" + name = "Head of Personnel's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/dark, /area/station/command/heads_quarters/hop) @@ -35127,11 +35127,11 @@ c_tag = "Command - Research Director's Office" }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Director's Desk"; - name = "Research Director's Requests Console" + name = "Research Director's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/dark, /area/station/command/heads_quarters/rd) @@ -40365,9 +40365,9 @@ /obj/machinery/power/apc/auto_name/directional/north, /obj/structure/cable, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Cargo"; - name = "Cargo Request Console" + name = "Cargo Request Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/smooth, /area/station/cargo/office) @@ -46965,11 +46965,11 @@ /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/light/cold/directional/west, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Chief Medical Officer's Desk"; - name = "Chief Medical Officer's Requests Console" + name = "Chief Medical Officer's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/stairs/left{ dir = 1 @@ -48250,11 +48250,11 @@ dir = 8 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; - name = "Bridge Requests Console" + name = "Bridge Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/dark, /area/station/command/bridge) @@ -78619,11 +78619,11 @@ /obj/machinery/power/apc/auto_name/directional/east, /obj/structure/table, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Telecomms Admin"; - name = "Telecomms Requests Console" + name = "Telecomms Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/plating, /area/station/tcommsat/computer) @@ -79527,10 +79527,10 @@ }, /obj/structure/cable, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; department = "Chief Engineer's Desk"; - name = "Chief Engineer's Requests Console" + name = "Chief Engineer's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/iron/dark/textured, /area/station/command/heads_quarters/ce) @@ -82252,11 +82252,11 @@ /area/station/commons/dorms/apartment2) "vRi" = ( /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Captain's Desk"; - name = "Captain's Requests Console" + name = "Captain's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/carpet, /area/station/command/heads_quarters/captain) diff --git a/_maps/map_files/VoidRaptor/VoidRaptor.dmm b/_maps/map_files/VoidRaptor/VoidRaptor.dmm index 203a366a62c..40c378499cb 100644 --- a/_maps/map_files/VoidRaptor/VoidRaptor.dmm +++ b/_maps/map_files/VoidRaptor/VoidRaptor.dmm @@ -3895,11 +3895,11 @@ /obj/machinery/photocopier, /obj/machinery/light/warm/directional/north, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Head of Personnel's Desk"; name = "Head of Personnel's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/bot, /turf/open/floor/carpet/executive, @@ -9220,11 +9220,11 @@ "cPs" = ( /obj/machinery/announcement_system, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Telecomms Admin"; - name = "Telecomms Requests Console" + name = "Telecomms Requests Console"; + can_send_announcements = 1 }, /obj/machinery/light_switch/directional/north, /obj/effect/turf_decal/bot, @@ -9598,12 +9598,12 @@ }, /obj/structure/filingcabinet/chestdrawer/wheeled, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Research Lab"; name = "Research Requests Console"; receive_ore_updates = 1; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/machinery/camera/directional/east{ c_tag = "Science - Research and Development"; @@ -37371,11 +37371,11 @@ pixel_y = -25 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; department = "Chief Engineer's Desk"; name = "Chief Engineer's Requests Console"; assistance_requestable = 1; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/bot, /turf/open/floor/carpet/orange, @@ -39115,11 +39115,11 @@ "liK" = ( /obj/machinery/modular_computer/console/preset/id, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Captain's Desk"; name = "Captain's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/structure/noticeboard/captain{ dir = 8; @@ -40740,12 +40740,12 @@ /area/station/service/chapel) "lGf" = ( /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; department = "Research Director's Desk"; name = "Research Director's Requests Console"; receive_ore_updates = 1; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/machinery/atmospherics/components/unary/vent_pump/on/layer4{ dir = 1 @@ -44480,11 +44480,11 @@ "mIj" = ( /obj/structure/table/reinforced/rglass, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Bridge"; name = "Bridge Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/item/storage/toolbox/emergency{ pixel_y = 4 @@ -61131,12 +61131,12 @@ /area/station/command/bridge) "rjy" = ( /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Head of Security's Desk"; name = "Head of Security's Requests Console"; pixel_x = 10; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/structure/cable, /obj/machinery/button/door/directional/north{ @@ -70485,11 +70485,11 @@ dir = 1 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; department = "Chief Medical Officer's Desk"; name = "Chief Medical Officer's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/effect/landmark/start/chief_medical_officer, /turf/open/floor/carpet/blue, @@ -75121,10 +75121,10 @@ /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /turf/open/floor/carpet/black, /area/station/command/heads_quarters/qm) @@ -75995,11 +75995,11 @@ /area/station/science/xenobiology) "vnh" = ( /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Captain's Desk"; name = "Captain's Requests Console"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /obj/structure/table/wood/fancy/royalblue, /obj/effect/spawner/random/food_or_drink/three_course_meal, diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm index 911fe8b5af4..527facfe1a9 100644 --- a/_maps/map_files/generic/CentCom.dmm +++ b/_maps/map_files/generic/CentCom.dmm @@ -8556,10 +8556,10 @@ /obj/structure/table/wood, /obj/item/flashlight/lamp, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Captain's Desk"; assistance_requestable = 1; - anon_tips_receiver = 1 + anon_tips_receiver = 1; + can_send_announcements = 1 }, /turf/open/floor/iron/grimy, /area/centcom/central_command_areas/admin) diff --git a/_maps/map_files/tramstation/tramstation.dmm b/_maps/map_files/tramstation/tramstation.dmm index d7ec5e2e556..9290226ec34 100644 --- a/_maps/map_files/tramstation/tramstation.dmm +++ b/_maps/map_files/tramstation/tramstation.dmm @@ -11281,11 +11281,11 @@ }, /obj/machinery/light/directional/west, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; assistance_requestable = 1; department = "Quartermaster's Desk"; name = "Quartermaster's Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /obj/machinery/camera{ c_tag = "Cargo - Quartermaster's Office"; @@ -19951,10 +19951,10 @@ dir = 1 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; department = "Chief Engineer's Desk"; name = "Chief Engineer's Request Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/machinery/computer/security/telescreen/engine{ dir = 4; @@ -28338,11 +28338,11 @@ /obj/item/clothing/glasses/hud/health, /obj/item/clothing/neck/stethoscope, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; assistance_requestable = 1; department = "Chief Medical Officer's Console"; name = "Chief Medical Officer's Request Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/effect/turf_decal/tile/blue/fourcorners, /turf/open/floor/iron/dark, @@ -30369,9 +30369,9 @@ dir = 1 }, /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; department = "Telecomms Admin"; - name = "Telecomms Requests Console" + name = "Telecomms Requests Console"; + can_send_announcements = 1 }, /obj/structure/disposalpipe/segment{ dir = 4 @@ -37434,10 +37434,10 @@ dir = 5 }, /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; department = "Research Lab"; name = "Research Requests Console"; - receive_ore_updates = 1 + receive_ore_updates = 1; + can_send_announcements = 1 }, /obj/structure/sign/clock/directional/north, /turf/open/floor/iron/white, @@ -42591,12 +42591,12 @@ dir = 1 }, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Bridge"; name = "Bridge Requests Console"; - pixel_y = 30 + pixel_y = 30; + can_send_announcements = 1 }, /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2, @@ -44994,10 +44994,10 @@ /area/station/commons/lounge) "pbf" = ( /obj/machinery/requests_console/directional/east{ - announcementConsole = 1; assistance_requestable = 1; department = "Captain's Desk"; - name = "Captain's Requests Console" + name = "Captain's Requests Console"; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/captain) @@ -46025,12 +46025,30 @@ pixel_x = -8 }, /obj/machinery/requests_console/directional/west{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Personnel's Desk"; name = "Head of Personnel's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 + }, +/obj/merge_conflict_marker{ + name = "---Merge Conflict Marker---"; + desc = "A best-effort merge was performed. You must resolve this conflict yourself (manually) and remove this object once complete." + }, +/obj/structure/table/wood, +/obj/item/folder/blue, +/obj/item/stamp/head/hop, +/obj/item/trapdoor_remote/preloaded{ + pixel_x = -8 + }, +/obj/machinery/requests_console/directional/west{ + anon_tips_receiver = 1; + assistance_requestable = 1; + department = "Head of Personnel's Desk"; + name = "Head of Personnel's Requests Console"; + supplies_requestable = 1; + can_send_announcements = 1 }, /turf/open/floor/wood, /area/station/command/heads_quarters/hop) @@ -48340,12 +48358,12 @@ /area/station/security/courtroom/holding) "qjw" = ( /obj/machinery/requests_console/directional/north{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Head of Security's Desk"; name = "Head of Security's Requests Console"; - supplies_requestable = 1 + supplies_requestable = 1; + can_send_announcements = 1 }, /obj/machinery/camera{ c_tag = "Security - Head of Security's Office"; @@ -56553,11 +56571,11 @@ }, /obj/machinery/suit_storage_unit/rd, /obj/machinery/requests_console/directional/south{ - announcementConsole = 1; anon_tips_receiver = 1; assistance_requestable = 1; department = "Research Director's Desk"; - name = "Research Director's Request Console" + name = "Research Director's Request Console"; + can_send_announcements = 1 }, /turf/open/floor/iron, /area/station/command/heads_quarters/rd) diff --git a/code/__DEFINES/radio.dm b/code/__DEFINES/radio.dm index 2793c54a6ab..f4967eb9ce3 100644 --- a/code/__DEFINES/radio.dm +++ b/code/__DEFINES/radio.dm @@ -114,6 +114,12 @@ #define REQ_HIGH_MESSAGE_PRIORITY 2 #define REQ_EXTREME_MESSAGE_PRIORITY 3 +#define ASSISTANCE_REQUEST "Assistance Request" +#define SUPPLY_REQUEST "Supplies Request" +#define INFORMATION_REQUEST "Relay Information" +#define ORE_UPDATE_REQUEST "Ore Update" +#define REPLY_REQUEST "Reply" + ///give this to can_receive to specify that there is no restriction on what z level this signal is sent to #define RADIO_NO_Z_LEVEL_RESTRICTION 0 diff --git a/code/datums/request_message.dm b/code/datums/request_message.dm new file mode 100644 index 00000000000..920f45dca53 --- /dev/null +++ b/code/datums/request_message.dm @@ -0,0 +1,57 @@ + +/datum/request_message + /// The r5tname of the department request console that sent the message + var/sender_department = "" + /// The time when the message arrived + var/received_time = null + /// The message itself + var/content = "" + /// The name on the ID that verified the message + var/message_verified_by = "" + /// The name of the stamp that verified the message + var/message_stamped_by = "" + /// The priority of the message + var/priority = "" + /// The radio frequency the message should be broadcasted on + var/radio_freq = null + /// The type of the request + var/request_type = "" + /// A list to be appended after the message, for example, list of ores + var/appended_list = list() + +/datum/request_message/New(data) + sender_department = data["sender_department"] + received_time = station_time_timestamp() + content = data["message"] + message_verified_by = data["verified"] + message_stamped_by = data["stamped"] + priority = data["priority"] + radio_freq = data["notify_freq"] + request_type = data["ore_update"] ? ORE_UPDATE_REQUEST : data["request_type"] + var/list/data_appended_list = data["appended_list"] + if(data_appended_list && data_appended_list.len) + appended_list = data_appended_list + +/// Retrieves the alert spoken/blared by the requests console that recieves this message +/datum/request_message/proc/get_alert() + var/authenticated = "" + if(message_verified_by) + authenticated = ", Verified by [message_verified_by] (Authenticated)" + else if (message_stamped_by) + authenticated = ", Stamped by [message_stamped_by] (Authenticated)" + + return "Message from [sender_department][authenticated]" + +/// Converts the message into a format for the tgui ui_data json +/datum/request_message/proc/message_ui_data() + var/list/ui_data = list() + ui_data["sender_department"] = sender_department + ui_data["received_time"] = received_time + ui_data["content"] = content + ui_data["message_verified_by"] = message_verified_by + ui_data["message_stamped_by"] = message_stamped_by + ui_data["priority"] = priority + ui_data["request_type"] = request_type + ui_data["appended_list"] = appended_list + + return ui_data diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 2298cd76158..4bef55b9450 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -1,28 +1,14 @@ -/******************** Requests Console ********************/ -/** Originally written by errorage, updated by: Carn, needs more work though. I just added some security fixes */ - GLOBAL_LIST_EMPTY(req_console_assistance) GLOBAL_LIST_EMPTY(req_console_supplies) GLOBAL_LIST_EMPTY(req_console_information) -GLOBAL_LIST_EMPTY(allConsoles) +GLOBAL_LIST_EMPTY(req_console_all) GLOBAL_LIST_EMPTY(req_console_ckey_departments) +#define REQ_EMERGENCY_SECURITY "Security" +#define REQ_EMERGENCY_ENGINEERING "Engineering" +#define REQ_EMERGENCY_MEDICAL "Medical" -#define REQ_SCREEN_MAIN 0 -#define REQ_SCREEN_REQ_ASSISTANCE 1 -#define REQ_SCREEN_REQ_SUPPLIES 2 -#define REQ_SCREEN_RELAY 3 -#define REQ_SCREEN_WRITE 4 -#define REQ_SCREEN_CHOOSE 5 -#define REQ_SCREEN_SENT 6 -#define REQ_SCREEN_ERR 7 -#define REQ_SCREEN_VIEW_MSGS 8 -#define REQ_SCREEN_AUTHENTICATE 9 -#define REQ_SCREEN_ANNOUNCE 10 - -#define REQ_EMERGENCY_SECURITY 1 -#define REQ_EMERGENCY_ENGINEERING 2 -#define REQ_EMERGENCY_MEDICAL 3 +#define ANNOUNCEMENT_COOLDOWN_TIME (30 SECONDS) /obj/machinery/requests_console name = "requests console" @@ -35,8 +21,6 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) armor_type = /datum/armor/machinery_requests_console /// Reference to our area var/area/area - /// Mapper helper to tie a request console to another area - var/areastring = null /// Is autonaming by area on? var/auto_name = FALSE /// Department name (Determined from this variable on each unit) Set this to the same thing if you want several consoles in one department @@ -44,44 +28,23 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) /// List of all messages var/list/messages = list() /// Priority of the latest message - var/newmessagepriority = REQ_NO_NEW_MESSAGE - /* - Define for the currently displayed page - 0 = main menu, - 1 = req. assistance, - 2 = req. supplies - 3 = relay information - 4 = write msg - not used - 5 = choose priority - not used - 6 = sent successfully - 7 = sent unsuccessfully - 8 = view messages - 9 = authentication before sending - 10 = send announcement - */ - var/screen = REQ_SCREEN_MAIN + var/new_message_priority = REQ_NO_NEW_MESSAGE // Is the console silent? Set to TRUE for it not to beep all the time var/silent = FALSE // Is the console hacked? Enables EXTREME priority if TRUE - var/hackState = FALSE + var/hack_state = FALSE /// FALSE = This console cannot be used to send department announcements, TRUE = This console can send department announcements - var/announcementConsole = FALSE + var/can_send_announcements = FALSE // TRUE if maintenance panel is open var/open = FALSE /// Will be set to TRUE when you authenticate yourself for announcements - var/announceAuth = FALSE + var/announcement_authenticated = FALSE /// Will contain the name of the person who verified it - var/msgVerified = "" + var/message_verified_by = "" /// If a message is stamped, this will contain the stamp name - var/msgStamped = "" - /// The message to be sent - var/message = "" - /// The department which will be receiving the message - var/to_department = "" - /// Priority of the message being sent - var/priority = REQ_NO_NEW_MESSAGE + var/message_stamped_by = "" /// Reference to the internal radio - var/obj/item/radio/Radio + var/obj/item/radio/radio ///If an emergency has been called by this device. Acts as both a cooldown and lets the responder know where it the emergency was triggered from var/emergency /// If ore redemption machines will send an update when it receives new ores. @@ -92,6 +55,10 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) var/supplies_requestable = FALSE /// Can you relay information to this console? var/anon_tips_receiver = FALSE + /// Did we error in the last mail? + var/has_mail_send_error = FALSE + /// Cooldown to prevent announcement spam + COOLDOWN_DECLARE(announcement_cooldown) /datum/armor/machinery_requests_console melee = 70 @@ -115,7 +82,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) else . += span_warning("The panel was pried open, you can close it with a crowbar.") - if(hackState) + if(hack_state) . += span_warning("The console seems to have been tampered with!") /obj/machinery/requests_console/update_overlays() @@ -129,11 +96,11 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) var/screen_state - if(emergency || (newmessagepriority == REQ_EXTREME_MESSAGE_PRIORITY)) + if(emergency || (new_message_priority == REQ_EXTREME_MESSAGE_PRIORITY)) screen_state = "[base_icon_state]3" - else if(newmessagepriority == REQ_HIGH_MESSAGE_PRIORITY) + else if(new_message_priority == REQ_HIGH_MESSAGE_PRIORITY) screen_state = "[base_icon_state]2" - else if(newmessagepriority == REQ_NORMAL_MESSAGE_PRIORITY) + else if(new_message_priority == REQ_NORMAL_MESSAGE_PRIORITY) screen_state = "[base_icon_state]1" else screen_state = "[base_icon_state]0" @@ -160,253 +127,200 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) else name = "\improper [department] requests console" // and if we have a 'department', our name should reflect that. - GLOB.allConsoles += src + GLOB.req_console_all += src - if((assistance_requestable) && !(department in GLOB.req_console_assistance)) // adding to assistance list if not already present - GLOB.req_console_assistance += department + if((assistance_requestable)) // adding to assistance list if not already present + GLOB.req_console_assistance |= department - if((supplies_requestable) && !(department in GLOB.req_console_supplies)) // supplier list - GLOB.req_console_supplies += department + if((supplies_requestable)) // supplier list + GLOB.req_console_supplies |= department - if((anon_tips_receiver) && !(department in GLOB.req_console_information)) // tips lists - GLOB.req_console_information += department + if((anon_tips_receiver)) // tips lists + GLOB.req_console_information |= department GLOB.req_console_ckey_departments[ckey(department)] = department // and then we set ourselves a listed name - Radio = new /obj/item/radio(src) - Radio.set_listening(FALSE) + radio = new /obj/item/radio(src) + radio.set_listening(FALSE) /obj/machinery/requests_console/Destroy() - QDEL_NULL(Radio) - GLOB.allConsoles -= src + QDEL_NULL(radio) + QDEL_LIST(messages) + GLOB.req_console_all -= src return ..() -/obj/machinery/requests_console/ui_interact(mob/user) - . = ..() - var/dat = "" - if(!open) - switch(screen) - if(REQ_SCREEN_MAIN) - announceAuth = FALSE - if (newmessagepriority == REQ_NORMAL_MESSAGE_PRIORITY) - dat += "
There are new messages

" - else if (newmessagepriority == REQ_HIGH_MESSAGE_PRIORITY) - dat += "
There are new PRIORITY messages

" - else if (newmessagepriority == REQ_EXTREME_MESSAGE_PRIORITY) - dat += "
There are new EXTREME PRIORITY messages

" - dat += "View Messages

" - - dat += "Request Assistance
" - dat += "Request Supplies
" - dat += "Relay Anonymous Information

" - - if(!emergency) - dat += "Emergency: Security
" - dat += "Emergency: Engineering
" - dat += "Emergency: Medical

" - else - dat += "[emergency] has been dispatched to this location.

" - - if(announcementConsole) - dat += "Send Station-wide Announcement

" - if (silent) - dat += "Speaker OFF" - else - dat += "Speaker ON" - if(REQ_SCREEN_REQ_ASSISTANCE) - dat += "Which department do you need assistance from?

" - dat += departments_table(GLOB.req_console_assistance) - - if(REQ_SCREEN_REQ_SUPPLIES) - dat += "Which department do you need supplies from?

" - dat += departments_table(GLOB.req_console_supplies) - - if(REQ_SCREEN_RELAY) - dat += "Which department would you like to send information to?

" - dat += departments_table(GLOB.req_console_information) - - if(REQ_SCREEN_SENT) - dat += "Message sent.

" - dat += "<< Back
" - - if(REQ_SCREEN_ERR) - dat += "An error occurred.

" - dat += "<< Back
" - - if(REQ_SCREEN_VIEW_MSGS) - for (var/obj/machinery/requests_console/Console in GLOB.allConsoles) - if (Console.department == department) - Console.newmessagepriority = REQ_NO_NEW_MESSAGE - Console.update_appearance() - - newmessagepriority = REQ_NO_NEW_MESSAGE - update_appearance() - var/messageComposite = "" - for(var/msg in messages) // This puts more recent messages at the *top*, where they belong. - messageComposite = "
[msg]
" + messageComposite - dat += messageComposite - dat += "
<< Back to Main Menu
" - - if(REQ_SCREEN_AUTHENTICATE) - dat += "Message Authentication

" - dat += "Message for [to_department]: [message]

" - dat += "
You may authenticate your message now by scanning your ID or your stamp

" - dat += "Validated by: [msgVerified ? msgVerified : "Not Validated"]
" - dat += "Stamped by: [msgStamped ? msgStamped : "Not Stamped"]

" - dat += "Send Message
" - dat += "
<< Discard Message
" - - if(REQ_SCREEN_ANNOUNCE) - dat += "

Station-wide Announcement

" - if(announceAuth) - dat += "
Authentication accepted

" - else - dat += "
Swipe your card to authenticate yourself

" - dat += "Message: [message ? message : "No Message"]
" - dat += "[message ? "Edit" : "Write"] Message

" - if ((announceAuth || isAdminGhostAI(user)) && message) - dat += "Announce Message
" - else - dat += "Announce Message
" - dat += "
<< Back
" - - if(!dat) - CRASH("No UI for src. Screen var is: [screen]") - var/datum/browser/popup = new(user, "req_console", "[name]", 450, 440) - popup.set_content(dat) - popup.open() - return - -/// Receives a list of department names, filters the request console list, and returns them formatted as a html table -/obj/machinery/requests_console/proc/departments_table(list/req_consoles) - var/dat = "" - dat += "" - for(var/req_dpt in req_consoles) - if (req_dpt != department) - dat += "" - dat += "" - dat += "" - dat += "" - dat += "
[req_dpt]Normal High" - if(hackState) - dat += "EXTREME" - dat += "
" - dat += "
<< Back
" - return dat - -/obj/machinery/requests_console/Topic(href, href_list) - if(..()) +/obj/machinery/requests_console/ui_interact(mob/user, datum/tgui/ui) + if(open) return - usr.set_machine(src) - add_fingerprint(usr) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "RequestsConsole") + ui.set_autoupdate(FALSE) + ui.open() - if(href_list["write"]) - to_department = ckey(reject_bad_text(href_list["write"])) //write contains the string of the receiving department's name +/obj/machinery/requests_console/ui_act(action, params) + . = ..() + if(.) + return - var/new_message = (to_department in GLOB.req_console_ckey_departments) && tgui_input_text(usr, "Write your message", "Awaiting Input") - if(new_message) - to_department = GLOB.req_console_ckey_departments[to_department] - message = new_message - screen = REQ_SCREEN_AUTHENTICATE - priority = clamp(text2num(href_list["priority"]), REQ_NORMAL_MESSAGE_PRIORITY, REQ_EXTREME_MESSAGE_PRIORITY) - - if(href_list["writeAnnouncement"]) - var/new_message = reject_bad_text(tgui_input_text(usr, "Write your message", "Awaiting Input")) - if(new_message) - message = new_message - priority = clamp(text2num(href_list["priority"]) || REQ_NORMAL_MESSAGE_PRIORITY, REQ_NORMAL_MESSAGE_PRIORITY, REQ_EXTREME_MESSAGE_PRIORITY) - else - message = "" - announceAuth = FALSE - screen = REQ_SCREEN_MAIN - - if(href_list["sendAnnouncement"]) - if(!announcementConsole) - return - if(!(announceAuth || isAdminGhostAI(usr))) - return - if(isliving(usr)) - var/mob/living/L = usr - message = L.treat_message(message) - minor_announce(message, "[department] Announcement:", html_encode = FALSE) - GLOB.news_network.submit_article(message, department, "Station Announcements", null) - usr.log_talk(message, LOG_SAY, tag="station announcement from [src]") - message_admins("[ADMIN_LOOKUPFLW(usr)] has made a station announcement from [src] at [AREACOORD(usr)].") - deadchat_broadcast(" made a station announcement from [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type=DEADCHAT_ANNOUNCEMENT) - announceAuth = FALSE - message = "" - screen = REQ_SCREEN_MAIN - - if(href_list["emergency"]) - if(!emergency) + switch(action) + if("clear_message_status") + has_mail_send_error = FALSE + for (var/obj/machinery/requests_console/console in GLOB.req_console_all) + if (console.department == department) + console.new_message_priority = REQ_NO_NEW_MESSAGE + console.update_appearance() + return TRUE + if("clear_authentication") + message_stamped_by = "" + message_verified_by = "" + announcement_authenticated = FALSE + return TRUE + if("toggle_silent") + silent = !silent + return TRUE + if("set_emergency") + if(emergency) + return var/radio_freq - switch(text2num(href_list["emergency"])) + switch(params["emergency"]) if(REQ_EMERGENCY_SECURITY) //Security radio_freq = FREQ_SECURITY - emergency = "Security" if(REQ_EMERGENCY_ENGINEERING) //Engineering radio_freq = FREQ_ENGINEERING - emergency = "Engineering" if(REQ_EMERGENCY_MEDICAL) //Medical radio_freq = FREQ_MEDICAL - emergency = "Medical" if(radio_freq) - Radio.set_frequency(radio_freq) - Radio.talk_into(src,"[emergency] emergency in [department]!!",radio_freq) + emergency = params["emergency"] + radio.set_frequency(radio_freq) + radio.talk_into(src,"[emergency] emergency in [department]!!",radio_freq) update_appearance() addtimer(CALLBACK(src, PROC_REF(clear_emergency)), 5 MINUTES) + return TRUE + if("send_announcement") + if(!COOLDOWN_FINISHED(src, announcement_cooldown)) + to_chat(usr, span_alert("Intercomms recharging. Please stand by.")) + return + if(!can_send_announcements) + return + if(!(announcement_authenticated || isAdminGhostAI(usr))) + return - if(href_list["send"] && message && to_department && priority) + var/message = reject_bad_text(params["message"]) + if(!message) + to_chat(usr, span_alert("Invalid message.")) + return + if(isliving(usr)) + var/mob/living/L = usr + message = L.treat_message(message) + minor_announce(message, "[department] Announcement:", html_encode = FALSE) + GLOB.news_network.submit_article(message, department, "Station Announcements", null) + usr.log_talk(message, LOG_SAY, tag="station announcement from [src]") + message_admins("[ADMIN_LOOKUPFLW(usr)] has made a station announcement from [src] at [AREACOORD(usr)].") + deadchat_broadcast(" made a station announcement from [span_name("[get_area_name(usr, TRUE)]")].", span_name("[usr.real_name]"), usr, message_type=DEADCHAT_ANNOUNCEMENT) - var/radio_freq - switch(ckey(to_department)) - if("bridge") - radio_freq = FREQ_COMMAND - if("medbay") - radio_freq = FREQ_MEDICAL - if("science") - radio_freq = FREQ_SCIENCE - if("engineering") - radio_freq = FREQ_ENGINEERING - if("security") - radio_freq = FREQ_SECURITY - if("cargobay", "mining") - radio_freq = FREQ_SUPPLY + COOLDOWN_START(src, announcement_cooldown, ANNOUNCEMENT_COOLDOWN_TIME) + announcement_authenticated = FALSE + return TRUE + if("quick_reply") + var/recipient = params["reply_recipient"] - var/datum/signal/subspace/messaging/rc/signal = new(src, list( - "sender" = department, - "rec_dpt" = to_department, - "send_dpt" = department, - "message" = message, - "verified" = msgVerified, - "stamped" = msgStamped, - "priority" = priority, - "notify_freq" = radio_freq - )) - signal.send_to_receivers() + var/reply_message = reject_bad_text(tgui_input_text(usr, "Write a quick reply to [recipient]", "Awaiting Input")) - screen = signal.data["done"] ? REQ_SCREEN_SENT : REQ_SCREEN_ERR + if(!reply_message) + has_mail_send_error = TRUE + playsound(src, 'sound/machines/buzz-two.ogg', 50, TRUE) + return TRUE - //Handle screen switching - if(href_list["setScreen"]) - var/set_screen = clamp(text2num(href_list["setScreen"]) || 0, REQ_SCREEN_MAIN, REQ_SCREEN_ANNOUNCE) - switch(set_screen) - if(REQ_SCREEN_MAIN) - to_department = "" - msgVerified = "" - msgStamped = "" - message = "" - priority = -1 - if(REQ_SCREEN_ANNOUNCE) - if(!announcementConsole) - return - screen = set_screen + send_message(recipient, reply_message, REQ_NORMAL_MESSAGE_PRIORITY, REPLY_REQUEST) + return TRUE + if("send_message") + var/recipient = params["recipient"] + if(!recipient) + return + var/priority = params["priority"] + if(!priority) + return + var/message = reject_bad_text(params["message"]) + if(!message) + to_chat(usr, span_alert("Invalid message.")) + has_mail_send_error = TRUE + return TRUE + var/request_type = params["request_type"] + if(!request_type) + return + send_message(recipient, message, priority, request_type) + return TRUE - //Handle silencing the console - if(href_list["setSilent"]) - silent = text2num(href_list["setSilent"]) ? TRUE : FALSE +///Sends the message from the request console +/obj/machinery/requests_console/proc/send_message(recipient, message, priority, request_type) + var/radio_freq + switch(ckey(recipient)) + if("bridge") + radio_freq = FREQ_COMMAND + if("medbay") + radio_freq = FREQ_MEDICAL + if("science") + radio_freq = FREQ_SCIENCE + if("engineering") + radio_freq = FREQ_ENGINEERING + if("security") + radio_freq = FREQ_SECURITY + if("cargobay", "mining") + radio_freq = FREQ_SUPPLY - updateUsrDialog() + var/datum/signal/subspace/messaging/rc/signal = new(src, list( + "sender_department" = department, + "recipient_department" = recipient, + "message" = message, + "verified" = message_verified_by, + "stamped" = message_stamped_by, + "priority" = priority, + "notify_freq" = radio_freq, + "request_type" = request_type, + )) + signal.send_to_receivers() + + has_mail_send_error = !signal.data["done"] + + if(!silent) + if(has_mail_send_error) + playsound(src, 'sound/machines/buzz-two.ogg', 50, TRUE) + else + playsound(src, 'sound/machines/twobeep.ogg', 50, TRUE) + + message_stamped_by = "" + message_verified_by = "" + +/obj/machinery/requests_console/ui_data(mob/user) + var/list/data = list() + data["is_admin_ghost_ai"] = isAdminGhostAI() + data["can_send_announcements"] = can_send_announcements + data["department"] = department + data["emergency"] = emergency + data["hack_state"] = hack_state + data["new_message_priority"] = new_message_priority + data["silent"] = silent + data["has_mail_send_error"] = has_mail_send_error + data["authentication_data"] = list( + "message_verified_by" = message_verified_by, + "message_stamped_by" = message_stamped_by, + "announcement_authenticated" = announcement_authenticated, + ) + data["messages"] = list() + for (var/datum/request_message/message in messages) + data["messages"] += list(message.message_ui_data()) + return data + + +/obj/machinery/requests_console/ui_static_data(mob/user) + var/list/data = list() + + data["assistance_consoles"] = GLOB.req_console_assistance - department + data["supply_consoles"] = GLOB.req_console_supplies - department + data["information_consoles"] = GLOB.req_console_information - department + + return data /obj/machinery/requests_console/say_mod(input, list/message_mods = list()) if(spantext_char(input, "!", -3)) @@ -419,53 +333,41 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) emergency = null update_appearance() -/// From message_server.dm: Console.createmessage(data["sender"], data["send_dpt"], data["message"], data["verified"], data["stamped"], data["priority"], data["notify_freq"]) -/obj/machinery/requests_console/proc/createmessage(source, source_department, message, msgVerified, msgStamped, priority, radio_freq) - var/linkedsender +/// From message_server.dm: Console.create_message(data) +/obj/machinery/requests_console/proc/create_message(data) - var/sending = "[message]
" - if(msgVerified) - sending = "[sending][msgVerified]
" - if(msgStamped) - sending = "[sending][msgStamped]
" + var/datum/request_message/new_message = new(data) - linkedsender = source_department ? "[source_department]" : (source || "unknown") - - var/authentic = (msgVerified || msgStamped) && " (Authenticated)" - var/alert = "Message from [source][authentic]" - var/silenced = silent - var/header = "From: [linkedsender] Received: [station_time_timestamp()]
" - - switch(priority) + switch(new_message.priority) if(REQ_NORMAL_MESSAGE_PRIORITY) - if(newmessagepriority < REQ_NORMAL_MESSAGE_PRIORITY) - newmessagepriority = REQ_NORMAL_MESSAGE_PRIORITY + if(new_message_priority < REQ_NORMAL_MESSAGE_PRIORITY) + new_message_priority = REQ_NORMAL_MESSAGE_PRIORITY update_appearance() if(REQ_HIGH_MESSAGE_PRIORITY) - header = "High Priority
[header]" - alert = "PRIORITY Alert from [source][authentic]" - if(newmessagepriority < REQ_HIGH_MESSAGE_PRIORITY) - newmessagepriority = REQ_HIGH_MESSAGE_PRIORITY + if(new_message_priority < REQ_HIGH_MESSAGE_PRIORITY) + new_message_priority = REQ_HIGH_MESSAGE_PRIORITY update_appearance() if(REQ_EXTREME_MESSAGE_PRIORITY) - header = "!!!Extreme Priority!!!
[header]" - alert = "EXTREME PRIORITY Alert from [source][authentic]" - silenced = FALSE - if(newmessagepriority < REQ_EXTREME_MESSAGE_PRIORITY) - newmessagepriority = REQ_EXTREME_MESSAGE_PRIORITY + silent = FALSE + if(new_message_priority < REQ_EXTREME_MESSAGE_PRIORITY) + new_message_priority = REQ_EXTREME_MESSAGE_PRIORITY update_appearance() - messages += "[header][sending]" + messages.Insert(1, new_message) //reverse order - if(!silenced) + SStgui.update_uis(src) + + var/alert = new_message.get_alert() + + if(!silent) playsound(src, 'sound/machines/twobeep_high.ogg', 50, TRUE) say(alert) - if(radio_freq) - Radio.set_frequency(radio_freq) - Radio.talk_into(src, "[alert]: [message]", radio_freq) + if(new_message.radio_freq) + radio.set_frequency(new_message.radio_freq) + radio.talk_into(src, "[alert]: [new_message.content]", new_message.radio_freq) /obj/machinery/requests_console/crowbar_act(mob/living/user, obj/item/tool) tool.play_tool_sound(src, 50) @@ -480,8 +382,8 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) /obj/machinery/requests_console/screwdriver_act(mob/living/user, obj/item/tool) if(open) - hackState = !hackState - if(hackState) + hack_state = !hack_state + if(hack_state) to_chat(user, span_notice("You modify the wiring.")) else to_chat(user, span_notice("You reset the wiring.")) @@ -491,25 +393,17 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) to_chat(user, span_warning("You must open the maintenance panel first!")) return TRUE -/obj/machinery/requests_console/attackby(obj/item/O, mob/user, params) - var/obj/item/card/id/ID = O.GetID() +/obj/machinery/requests_console/attackby(obj/item/attacking_item, mob/user, params) + var/obj/item/card/id/ID = attacking_item.GetID() if(ID) - if(screen == REQ_SCREEN_AUTHENTICATE) - msgVerified = "Verified by [ID.registered_name] ([ID.assignment])" - updateUsrDialog() - if(screen == REQ_SCREEN_ANNOUNCE) - if (ACCESS_RC_ANNOUNCE in ID.access) - announceAuth = TRUE - else - announceAuth = FALSE - to_chat(user, span_warning("You are not authorized to send announcements!")) - updateUsrDialog() + message_verified_by = "[ID.registered_name] ([ID.assignment])" + announcement_authenticated = (ACCESS_RC_ANNOUNCE in ID.access) + SStgui.update_uis(src) return - if (istype(O, /obj/item/stamp)) - if(screen == REQ_SCREEN_AUTHENTICATE) - var/obj/item/stamp/T = O - msgStamped = span_boldnotice("Stamped with the [T.name]") - updateUsrDialog() + if (istype(attacking_item, /obj/item/stamp)) + var/obj/item/stamp/attacking_stamp = attacking_item + message_stamped_by = attacking_stamp.name + SStgui.update_uis(src) return return ..() @@ -536,14 +430,4 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/requests_console/auto_name, 30) #undef REQ_EMERGENCY_ENGINEERING #undef REQ_EMERGENCY_MEDICAL -#undef REQ_SCREEN_MAIN -#undef REQ_SCREEN_REQ_ASSISTANCE -#undef REQ_SCREEN_REQ_SUPPLIES -#undef REQ_SCREEN_RELAY -#undef REQ_SCREEN_WRITE -#undef REQ_SCREEN_CHOOSE -#undef REQ_SCREEN_SENT -#undef REQ_SCREEN_ERR -#undef REQ_SCREEN_VIEW_MSGS -#undef REQ_SCREEN_AUTHENTICATE -#undef REQ_SCREEN_ANNOUNCE +#undef ANNOUNCEMENT_COOLDOWN_TIME diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index b27d18802ab..9e799b3595a 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -197,10 +197,10 @@ /datum/signal/subspace/messaging/rc/broadcast() if (!logged) // Like /pda, only if logged return - var/rec_dpt = ckey(data["rec_dpt"]) - for (var/obj/machinery/requests_console/Console in GLOB.allConsoles) - if(ckey(Console.department) == rec_dpt || (data["ore_update"] && Console.receive_ore_updates)) - Console.createmessage(data["sender"], data["send_dpt"], data["message"], data["verified"], data["stamped"], data["priority"], data["notify_freq"]) + var/recipient_department = ckey(data["recipient_department"]) + for (var/obj/machinery/requests_console/console in GLOB.req_console_all) + if(ckey(console.department) == recipient_department || (data["ore_update"] && console.receive_ore_updates)) + console.create_message(data) // Log datums stored by the message server. /datum/data_tablet_msg diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 53ceb9aa7aa..0989b19c5c2 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -319,7 +319,7 @@ areas_with_air_alarm.Add(A.type) CHECK_TICK - for(var/obj/machinery/requests_console/RC in GLOB.allConsoles) + for(var/obj/machinery/requests_console/RC in GLOB.req_console_all) var/area/A = get_area(RC) if(!A) dat += "Skipped over [RC] in invalid location, [RC.loc].
" diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 6222767d83b..fcfc7d416ac 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -136,27 +136,29 @@ console_notify_timer = null - var/area/A = get_area(src) - var/msg = "Now available in [A]:
" + var/area/our_area = get_area(src) + var/message = "Now available in [our_area]:" var/has_minerals = FALSE + var/list/appended_list = list() - for(var/mat in mat_container.materials) - var/datum/material/M = mat - var/mineral_amount = mat_container.materials[mat] / SHEET_MATERIAL_AMOUNT + for(var/current_material in mat_container.materials) + var/datum/material/material_datum = current_material + var/mineral_amount = mat_container.materials[current_material] / SHEET_MATERIAL_AMOUNT if(mineral_amount) has_minerals = TRUE - msg += "[capitalize(M.name)]: [mineral_amount] sheets
" + appended_list["[capitalize(material_datum.name)]"] = "[mineral_amount] sheets" if(!has_minerals) return var/datum/signal/subspace/messaging/rc/signal = new(src, list( "ore_update" = TRUE, - "sender" = "Ore Redemption Machine", - "message" = msg, - "verified" = "Verified by Ore Redemption Machine", - "priority" = REQ_NORMAL_MESSAGE_PRIORITY + "sender_department" = "Ore Redemption Machine", + "message" = message, + "verified" = "Ore Redemption Machine", + "priority" = REQ_NORMAL_MESSAGE_PRIORITY, + "appended_list" = appended_list, )) signal.send_to_receivers() diff --git a/tgstation.dme b/tgstation.dme index 8450ca7217e..3b73cc79259 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -765,6 +765,7 @@ #include "code\datums\profiling.dm" #include "code\datums\progressbar.dm" #include "code\datums\recipe.dm" +#include "code\datums\request_message.dm" #include "code\datums\ruins.dm" #include "code\datums\saymode.dm" #include "code\datums\shuttles.dm" diff --git a/tgui/packages/tgui/interfaces/RequestsConsole/AnnouncementTab.tsx b/tgui/packages/tgui/interfaces/RequestsConsole/AnnouncementTab.tsx new file mode 100644 index 00000000000..8523c4555f5 --- /dev/null +++ b/tgui/packages/tgui/interfaces/RequestsConsole/AnnouncementTab.tsx @@ -0,0 +1,72 @@ +import { useBackend, useLocalState } from '../../backend'; +import { Button, NoticeBox, Section, TextArea } from '../../components'; +import { RequestsData } from './types'; + +export const AnnouncementTab = (props, context) => { + const { act, data } = useBackend(context); + const { authentication_data, is_admin_ghost_ai } = data; + const [messageText, setMessageText] = useLocalState( + context, + 'messageText', + '' + ); + return ( +
+