From e913a5eeccec100b5e446b34a845a0dc2b4c981a Mon Sep 17 00:00:00 2001 From: forest2001 Date: Mon, 27 May 2024 18:03:41 +0100 Subject: [PATCH] sentries in other UIs --- code/game/machinery/ARES/ARES_interface.dm | 16 +++++ .../machinery/ARES/ARES_interface_admin.dm | 13 +++- .../machinery/ARES/ARES_interface_apollo.dm | 4 +- code/game/machinery/ARES/ARES_procs.dm | 1 + code/game/machinery/ARES/apollo_pda.dm | 16 ++++- code/game/machinery/ARES/debug_pda.dm | 15 +++++ tgui/packages/tgui/interfaces/AresAdmin.jsx | 59 +++++++++++++------ .../tgui/interfaces/AresInterface.jsx | 51 +++++++++++----- 8 files changed, 136 insertions(+), 39 deletions(-) diff --git a/code/game/machinery/ARES/ARES_interface.dm b/code/game/machinery/ARES/ARES_interface.dm index 4399c7399684..b7a2333f36db 100644 --- a/code/game/machinery/ARES/ARES_interface.dm +++ b/code/game/machinery/ARES/ARES_interface.dm @@ -217,6 +217,8 @@ data["security_vents"] = link.get_ares_vents() data["sentry_setting"] = link.faction_label + data["sentry_setting"] = link.faction_label + data["faction_options"] = link.faction_options return data @@ -549,5 +551,19 @@ aicore_lockdown(user) return TRUE + if("update_sentries") + playsound = FALSE + var/new_iff = params["chosen_iff"] + if(!new_iff) + to_chat(user, SPAN_WARNING("ERROR: Unknown setting.")) + playsound(src, 'sound/machines/buzz-two.ogg', 15, 1) + return FALSE + if(new_iff == link.faction_label) + return FALSE + link.change_iff(new_iff) + playsound(src, 'sound/machines/chime.ogg', 15, 1) + to_chat(user, SPAN_WARNING("Sentry IFF settings updated!")) + return TRUE + if(playsound) playsound(src, "keyboard_alt", 15, 1) diff --git a/code/game/machinery/ARES/ARES_interface_admin.dm b/code/game/machinery/ARES/ARES_interface_admin.dm index 0c0b240617bf..0756c8b01db9 100644 --- a/code/game/machinery/ARES/ARES_interface_admin.dm +++ b/code/game/machinery/ARES/ARES_interface_admin.dm @@ -234,8 +234,8 @@ data["access_tickets"] = logged_access data["security_vents"] = get_ares_vents() - data["sentry_setting"] = faction_label + data["faction_options"] = faction_options return data @@ -525,3 +525,14 @@ return FALSE aicore_lockdown(user) return TRUE + + if("update_sentries") + var/new_iff = params["chosen_iff"] + if(!new_iff) + to_chat(user, SPAN_WARNING("ERROR: Unknown setting.")) + return FALSE + if(new_iff == faction_label) + return FALSE + change_iff(new_iff) + to_chat(user, SPAN_WARNING("Sentry IFF settings updated!")) + return TRUE diff --git a/code/game/machinery/ARES/ARES_interface_apollo.dm b/code/game/machinery/ARES/ARES_interface_apollo.dm index f3bfd3c63851..fe0f26880a16 100644 --- a/code/game/machinery/ARES/ARES_interface_apollo.dm +++ b/code/game/machinery/ARES/ARES_interface_apollo.dm @@ -142,9 +142,8 @@ data["access_tickets"] = logged_access data["security_vents"] = link.get_ares_vents() - data["sentry_setting"] = link.faction_label - data["faction_options"] = list(FACTION_MARINE, FACTION_WY, "USCM-WY", FACTION_ARES) + data["faction_options"] = link.faction_options return data @@ -458,6 +457,7 @@ return FALSE link.change_iff(new_iff) playsound(src, 'sound/machines/chime.ogg', 15, 1) + to_chat(user, SPAN_WARNING("Sentry IFF settings updated!")) return TRUE if(playsound) diff --git a/code/game/machinery/ARES/ARES_procs.dm b/code/game/machinery/ARES/ARES_procs.dm index 495a9488b84a..019fd4978bed 100644 --- a/code/game/machinery/ARES/ARES_procs.dm +++ b/code/game/machinery/ARES/ARES_procs.dm @@ -43,6 +43,7 @@ GLOBAL_LIST_INIT(maintenance_categories, list( ///Sentry faction stuff var/faction_label = FACTION_MARINE var/list/faction_group = FACTION_LIST_ARES_MARINE + var/list/faction_options = list(FACTION_MARINE, FACTION_WY, "USCM-WY", FACTION_ARES) var/list/core_sentries = list() /datum/ares_link/New() diff --git a/code/game/machinery/ARES/apollo_pda.dm b/code/game/machinery/ARES/apollo_pda.dm index 925962cba4d5..cd5de02a1ddb 100644 --- a/code/game/machinery/ARES/apollo_pda.dm +++ b/code/game/machinery/ARES/apollo_pda.dm @@ -167,8 +167,8 @@ data["access_tickets"] = logged_access data["security_vents"] = link.get_ares_vents() - data["sentry_setting"] = link.faction_label + data["faction_options"] = link.faction_options return data @@ -472,6 +472,20 @@ aicore_lockdown(user) return TRUE + if("update_sentries") + playsound = FALSE + var/new_iff = params["chosen_iff"] + if(!new_iff) + to_chat(user, SPAN_WARNING("ERROR: Unknown setting.")) + playsound(src, 'sound/machines/buzz-two.ogg', 15, 1) + return FALSE + if(new_iff == link.faction_label) + return FALSE + link.change_iff(new_iff) + playsound(src, 'sound/machines/chime.ogg', 15, 1) + to_chat(user, SPAN_WARNING("Sentry IFF settings updated!")) + return TRUE + if(playsound) var/sound = pick('sound/machines/pda_button1.ogg', 'sound/machines/pda_button2.ogg') playsound(src, sound, 15, TRUE) diff --git a/code/game/machinery/ARES/debug_pda.dm b/code/game/machinery/ARES/debug_pda.dm index 90816d8423ba..72f52c412909 100644 --- a/code/game/machinery/ARES/debug_pda.dm +++ b/code/game/machinery/ARES/debug_pda.dm @@ -278,6 +278,8 @@ data["access_tickets"] = logged_access data["security_vents"] = link.get_ares_vents() + data["sentry_setting"] = link.faction_label + data["faction_options"] = link.faction_options return data @@ -735,6 +737,19 @@ sec_vent.create_gas(VENT_GAS_CN20_XENO, 6, 5 SECONDS) log_admin("[key_name(user)] released nerve gas from Vent '[sec_vent.vent_tag]' via ARES.") + if("update_sentries") + playsound = FALSE + var/new_iff = params["chosen_iff"] + if(!new_iff) + to_chat(user, SPAN_WARNING("ERROR: Unknown setting.")) + playsound(src, 'sound/machines/buzz-two.ogg', 15, 1) + return FALSE + if(new_iff == link.faction_label) + return FALSE + link.change_iff(new_iff) + playsound(src, 'sound/machines/chime.ogg', 15, 1) + to_chat(user, SPAN_WARNING("Sentry IFF settings updated!")) + return TRUE if(playsound) var/sound = pick('sound/machines/pda_button1.ogg', 'sound/machines/pda_button2.ogg') diff --git a/tgui/packages/tgui/interfaces/AresAdmin.jsx b/tgui/packages/tgui/interfaces/AresAdmin.jsx index 4e0bc465e1ee..b1848de79c29 100644 --- a/tgui/packages/tgui/interfaces/AresAdmin.jsx +++ b/tgui/packages/tgui/interfaces/AresAdmin.jsx @@ -1,5 +1,5 @@ import { useBackend } from '../backend'; -import { Box, Button, Flex, Section, Stack } from '../components'; +import { Box, Button, Dropdown, Flex, Section, Stack } from '../components'; import { Window } from '../layouts'; const PAGES = { @@ -96,8 +96,16 @@ const Login = (props) => { const MainMenu = (props) => { const { data, act } = useBackend(); - const { logged_in, access_text, last_page, current_menu, sudo, admin_login } = - data; + const { + logged_in, + access_text, + last_page, + current_menu, + sudo, + admin_login, + faction_options, + sentry_setting, + } = data; return ( <> @@ -412,28 +420,41 @@ const MainMenu = (props) => { color="red" ml="auto" px="2rem" - width="50%" + width="100%" bold onClick={() => act('page_core_sec')} > Nerve Gas Control - act('security_lockdown')} - disabled={remotelock} - > - AI Core Lockdown - + + + act('security_lockdown')} + > + AI Core Lockdown + + + + + act('update_sentries', { chosen_iff: value }) + } + width="90px" + tooltip="Change core sentries IFF settings." + /> + +
diff --git a/tgui/packages/tgui/interfaces/AresInterface.jsx b/tgui/packages/tgui/interfaces/AresInterface.jsx index e90330bd7c46..eee27adfb9e0 100644 --- a/tgui/packages/tgui/interfaces/AresInterface.jsx +++ b/tgui/packages/tgui/interfaces/AresInterface.jsx @@ -3,7 +3,7 @@ // -------------------------------------------------------------------- // import { useBackend } from '../backend'; -import { Box, Button, Flex, Section, Stack } from '../components'; +import { Box, Button, Dropdown, Flex, Section, Stack } from '../components'; import { Window } from '../layouts'; const PAGES = { @@ -93,6 +93,8 @@ const MainMenu = (props) => { last_page, current_menu, access_level, + faction_options, + sentry_setting, sudo, } = data; @@ -385,7 +387,6 @@ const MainMenu = (props) => { )} )} @@ -415,19 +418,35 @@ const MainMenu = (props) => { > Nerve Gas Control - act('security_lockdown')} - > - AI Core Lockdown - + + + act('security_lockdown')} + > + AI Core Lockdown + + + + + act('update_sentries', { chosen_iff: value }) + } + width="90px" + disabled={access_level < 9} + tooltip="Change core sentries IFF settings." + /> + +
)}