From d9b2ab89e433e08a22bcd614d99303482396d7f3 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Tue, 7 Jun 2022 00:00:39 +0100 Subject: [PATCH 01/16] UI button (#744) --- code/modules/power/apc/apc_main.dm | 10 +++++++++- tgui/packages/tgui/interfaces/Apc.js | 26 +++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index e7fcd16fcbc..4c59bfb4ab2 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -264,6 +264,7 @@ "coverLocked" = coverlocked, "siliconUser" = user.has_unlimited_silicon_privilege || user.using_power_flow_console(), "malfStatus" = get_malf_status(user), + "mainLights" = area.lightswitch, "emergencyLights" = !emergency_lights, "nightshiftLights" = nightshift_lights, @@ -308,9 +309,10 @@ . = UI_INTERACTIVE /obj/machinery/power/apc/ui_act(action, params) + var/list/locked_actions = list("main_lights", "toggle_nightshift") . = ..() - if(. || !can_use(usr, 1) || (locked && !usr.has_unlimited_silicon_privilege && !failure_timer && action != "toggle_nightshift")) + if(. || !can_use(usr, 1) || (locked && !usr.has_unlimited_silicon_privilege && !failure_timer && !(action in locked_actions))) return switch(action) if("lock") @@ -367,6 +369,12 @@ failure_timer = 0 update_appearance() update() + if("main_lights") + area.lightswitch = !area.lightswitch + area.power_change() + for(var/obj/machinery/light_switch/light_switch in area) + light_switch.update_appearance() + SEND_SIGNAL(light_switch, COMSIG_LIGHT_SWITCH_SET, area.lightswitch) if("emergency_lighting") emergency_lights = !emergency_lights for(var/obj/machinery/light/L in area) diff --git a/tgui/packages/tgui/interfaces/Apc.js b/tgui/packages/tgui/interfaces/Apc.js index 1bcf7956ea7..1ac2447b63d 100644 --- a/tgui/packages/tgui/interfaces/Apc.js +++ b/tgui/packages/tgui/interfaces/Apc.js @@ -7,8 +7,8 @@ export const Apc = (props, context) => { return ( - + height={432}> + @@ -86,7 +86,17 @@ const ApcContent = (props, context) => { return ( <> -
+
act('main_lights')} + /> + )} + > { label="Emergency Lighting" buttons={(