From 0a3ec28175690c094e45c8c23a350fbccea57277 Mon Sep 17 00:00:00 2001 From: Jerry <55355646+Jewelry-x@users.noreply.github.com> Date: Wed, 25 Sep 2024 20:39:15 +0300 Subject: [PATCH] Implement functionality to toggle broadcast camera microphone on and off, independent of camera state. (#86694) Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> --- .../objects/items/devices/broadcast_camera.dm | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/code/game/objects/items/devices/broadcast_camera.dm b/code/game/objects/items/devices/broadcast_camera.dm index 7ab68b8a557..78868844e48 100644 --- a/code/game/objects/items/devices/broadcast_camera.dm +++ b/code/game/objects/items/devices/broadcast_camera.dm @@ -22,6 +22,8 @@ light_on = FALSE /// Is camera streaming var/active = FALSE + /// Is the microphone turned on + var/active_microphone = TRUE /// The name of the broadcast var/broadcast_name = "Curator News" /// The networks it broadcasts to, default is CAMERANET_NETWORK_CURATOR @@ -56,6 +58,7 @@ /obj/item/broadcast_camera/examine(mob/user) . = ..() . += span_notice("Broadcast name is [broadcast_name]") + . += span_notice("The microphone is [active_microphone ? "On" : "Off"]") /obj/item/broadcast_camera/on_enter_storage(datum/storage/master_storage) . = ..() @@ -85,6 +88,8 @@ // INTERNAL RADIO internal_radio = new(src) + /// Sets the state of the microphone + set_microphone_state() set_light_on(TRUE) playsound(source = src, soundin = 'sound/machines/terminal/terminal_processing.ogg', vol = 20, vary = FALSE, ignore_walls = FALSE) @@ -102,3 +107,18 @@ set_light_on(FALSE) playsound(source = src, soundin = 'sound/machines/terminal/terminal_prompt_deny.ogg', vol = 20, vary = FALSE, ignore_walls = FALSE) balloon_alert_to_viewers("offline") + +/obj/item/broadcast_camera/click_alt(mob/user) + active_microphone = !active_microphone + + /// Text popup for letting the user know that the microphone has changed state + balloon_alert(user, "turned [active_microphone ? "on" : "off"] the microphone.") + + ///If the radio exists as an object, set its state accordingly + if(active) + set_microphone_state() + + return CLICK_ACTION_SUCCESS + +/obj/item/broadcast_camera/proc/set_microphone_state() + internal_radio.set_broadcasting(active_microphone)