From 5e75232d75fc7700a44704ff82e4de75158b5bd1 Mon Sep 17 00:00:00 2001 From: ihatethisengine <115417687+ihatethisengine@users.noreply.github.com> Date: Sun, 7 Apr 2024 20:59:17 +0300 Subject: [PATCH] Low effort broadcasting (#6078) # About the pull request Adds a simple way for CC to broadcast stuff to the only TV on Almayer. Just wield the camera. # Explain why it's good for the game CC buff. # Testing Photographs and Procedure
I tested this...
# Changelog :cl: ihatethisengine add: CC camera now can broadcast to TVs. /:cl: --------- Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com> --- code/__DEFINES/camera.dm | 1 + .../dcs/signals/atom/signals_item.dm | 3 ++ code/game/machinery/camera/camera.dm | 18 +++++++- .../game/machinery/computer/camera_console.dm | 42 ++++++++++++++++++- .../vending/vendor_types/engineering.dm | 1 + .../objects/items/circuitboards/computer.dm | 6 +++ code/modules/paperwork/photography.dm | 27 ++++++++++++ .../LV522_Chances_Claim.dmm | 12 +++--- maps/map_files/USS_Almayer/USS_Almayer.dmm | 6 +-- 9 files changed, 104 insertions(+), 12 deletions(-) diff --git a/code/__DEFINES/camera.dm b/code/__DEFINES/camera.dm index 9d797b964d61..f50d7d8e2c72 100644 --- a/code/__DEFINES/camera.dm +++ b/code/__DEFINES/camera.dm @@ -16,6 +16,7 @@ #define CAMERA_NET_VEHICLE "Vehicle" #define CAMERA_NET_LANDING_ZONES "Landing Zones" #define CAMERA_NET_LASER_TARGETS "Laser Targets" +#define CAMERA_NET_CORRESPONDENT "Combat Correspondent Live" #define CAMERA_NET_POWER_ALARMS "Power Alarms" #define CAMERA_NET_ATMOSPHERE_ALARMS "Atmosphere Alarms" diff --git a/code/__DEFINES/dcs/signals/atom/signals_item.dm b/code/__DEFINES/dcs/signals/atom/signals_item.dm index f0456f8dd9f6..f038d4c5dbce 100644 --- a/code/__DEFINES/dcs/signals/atom/signals_item.dm +++ b/code/__DEFINES/dcs/signals/atom/signals_item.dm @@ -29,6 +29,9 @@ #define COMSIG_ITEM_PICKUP "item_pickup" +///from /obj/item/device/camera/broadcasting/attack_self +#define COMSIG_BROADCAST_GO_LIVE "broadcast_live" + /// from /obj/item/proc/mob_can_equip #define COMSIG_ITEM_ATTEMPTING_EQUIP "item_attempting_equip" ///Return this in response if you don't want items equipped diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 7621e82ce936..948d83e76148 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -69,7 +69,7 @@ GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera) var/area/my_area = get_area(src) if(my_area) for(var/obj/structure/machinery/camera/autoname/current_camera in GLOB.machines) - if(current_camera == src) + if(current_camera == src) continue var/area/current_camera_area = get_area(current_camera) if(current_camera_area.type != my_area.type) @@ -299,6 +299,22 @@ GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera) return 1 return 0 +/obj/structure/machinery/camera/correspondent + network = list(CAMERA_NET_CORRESPONDENT) + invisibility = INVISIBILITY_ABSTRACT + invuln = TRUE + unslashable = TRUE + unacidable = TRUE + colony_camera_mapload = FALSE + var/obj/item/device/camera/broadcasting/linked_broadcasting + +/obj/structure/machinery/camera/correspondent/Initialize(mapload, obj/item/device/camera/broadcasting/camera_item) + . = ..() + if(!camera_item) + return INITIALIZE_HINT_QDEL + c_tag = camera_item.get_broadcast_name() + linked_broadcasting = camera_item + /obj/structure/machinery/camera/mortar alpha = 0 mouse_opacity = MOUSE_OPACITY_TRANSPARENT diff --git a/code/game/machinery/computer/camera_console.dm b/code/game/machinery/computer/camera_console.dm index f36719a8453e..cd0ee780f478 100644 --- a/code/game/machinery/computer/camera_console.dm +++ b/code/game/machinery/computer/camera_console.dm @@ -202,10 +202,48 @@ name = "Ship Security Cameras" network = list(CAMERA_NET_ALMAYER) -/obj/structure/machinery/computer/cameras/wooden_tv/prop +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast name = "Television Set" desc = "An old TV hooked up to a video cassette recorder, you can even use it to time shift WOW." - network = null + network = list(CAMERA_NET_CORRESPONDENT) + var/obj/item/device/camera/broadcasting/broadcastingcamera = null + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/Destroy() + broadcastingcamera = null + return ..() + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/ui_state(mob/user) + return GLOB.default_state + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/ui_act(action, params) + . = ..() + if(action != "switch_camera") + return + broadcastingcamera = null + if (!istype(current, /obj/structure/machinery/camera/correspondent)) + return + var/obj/structure/machinery/camera/correspondent/corr_cam = current + if (!corr_cam.linked_broadcasting) + return + broadcastingcamera = corr_cam.linked_broadcasting + RegisterSignal(broadcastingcamera, COMSIG_BROADCAST_GO_LIVE, PROC_REF(go_back_live)) + RegisterSignal(broadcastingcamera, COMSIG_PARENT_QDELETING, PROC_REF(clear_camera)) + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/ui_close(mob/user) + . = ..() + if (!current && broadcastingcamera) + clear_camera() + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/proc/clear_camera() + SIGNAL_HANDLER + UnregisterSignal(broadcastingcamera, list(COMSIG_BROADCAST_GO_LIVE, COMSIG_PARENT_QDELETING)) + broadcastingcamera = null + +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast/proc/go_back_live(obj/item/device/camera/broadcasting/broadcastingcamera) + SIGNAL_HANDLER + if (current.c_tag == broadcastingcamera.get_broadcast_name()) + current = broadcastingcamera.linked_cam + SEND_SIGNAL(src, COMSIG_CAMERA_SET_TARGET, broadcastingcamera.linked_cam, broadcastingcamera.linked_cam.view_range, broadcastingcamera.linked_cam.view_range) /obj/structure/machinery/computer/cameras/wooden_tv/ot name = "Mortar Monitoring Set" diff --git a/code/game/machinery/vending/vendor_types/engineering.dm b/code/game/machinery/vending/vendor_types/engineering.dm index 245e06009695..826f4431235b 100644 --- a/code/game/machinery/vending/vendor_types/engineering.dm +++ b/code/game/machinery/vending/vendor_types/engineering.dm @@ -92,6 +92,7 @@ list("Auxiliar Power Storage Unit", 2, /obj/item/circuitboard/machine/ghettosmes, VENDOR_ITEM_REGULAR), list("Air Alarm Electronics", 2, /obj/item/circuitboard/airalarm, VENDOR_ITEM_REGULAR), list("Security Camera Monitor", 2, /obj/item/circuitboard/computer/cameras, VENDOR_ITEM_REGULAR), + list("Television Set", 4, /obj/item/circuitboard/computer/cameras/tv, VENDOR_ITEM_REGULAR), list("Station Alerts", 2, /obj/item/circuitboard/computer/stationalert, VENDOR_ITEM_REGULAR), list("Arcade", 2, /obj/item/circuitboard/computer/arcade, VENDOR_ITEM_REGULAR), list("Atmospheric Monitor", 2, /obj/item/circuitboard/computer/air_management, VENDOR_ITEM_REGULAR), diff --git a/code/game/objects/items/circuitboards/computer.dm b/code/game/objects/items/circuitboards/computer.dm index 08dcfc6964a6..ecdfba00719d 100644 --- a/code/game/objects/items/circuitboards/computer.dm +++ b/code/game/objects/items/circuitboards/computer.dm @@ -26,6 +26,12 @@ if (..(C)) network = C.network +/obj/item/circuitboard/computer/cameras/tv + name = "Circuit board (Television Set)" + build_path = /obj/structure/machinery/computer/cameras/wooden_tv/broadcast + network = list(CAMERA_NET_CORRESPONDENT) + req_access = list() + /obj/item/circuitboard/computer/cameras/engineering name = "Circuit board (Engineering Camera Monitor)" build_path = /obj/structure/machinery/computer/cameras/engineering diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 69ce9ec4ce13..5614a4ffe52b 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -357,6 +357,33 @@ pictures_max = 20 w_class = SIZE_HUGE flags_equip_slot = NO_FLAGS //cannot be equiped + var/obj/structure/machinery/camera/correspondent/linked_cam + +/obj/item/device/camera/broadcasting/Destroy() + clear_broadcast() + return ..() + +/obj/item/device/camera/broadcasting/wield(mob/user) + . = ..() + if(!.) + return + linked_cam = new(loc, src) + SEND_SIGNAL(src, COMSIG_BROADCAST_GO_LIVE) + to_chat(user, SPAN_NOTICE("[src] begins to buzz softly as you go live.")) + +/obj/item/device/camera/broadcasting/unwield(mob/user) + . = ..() + clear_broadcast() + +/obj/item/device/camera/broadcasting/proc/clear_broadcast() + if(!QDELETED(linked_cam)) + QDEL_NULL(linked_cam) + +/obj/item/device/camera/broadcasting/proc/get_broadcast_name() + var/datum/component/label/src_label_component = GetComponent(/datum/component/label) + if(src_label_component) + return src_label_component.label_name + return "Broadcast [serial_number]" /obj/item/photo/proc/construct(datum/picture/P) icon = P.fields["icon"] diff --git a/maps/map_files/LV522_Chances_Claim/LV522_Chances_Claim.dmm b/maps/map_files/LV522_Chances_Claim/LV522_Chances_Claim.dmm index 4da1bbb7ff45..38c917ce08e8 100644 --- a/maps/map_files/LV522_Chances_Claim/LV522_Chances_Claim.dmm +++ b/maps/map_files/LV522_Chances_Claim/LV522_Chances_Claim.dmm @@ -6863,7 +6863,7 @@ /area/lv522/atmos/east_reactor) "dkJ" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ dir = 8; layer = 3; pixel_x = 5; @@ -15281,7 +15281,7 @@ /area/lv522/outdoors/nw_rockies) "gEQ" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ dir = 1; pixel_x = -10; pixel_y = 6 @@ -20248,7 +20248,7 @@ /area/lv522/outdoors/nw_rockies) "ivN" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ pixel_y = 8 }, /turf/open/floor/prison{ @@ -26446,7 +26446,7 @@ /area/lv522/atmos/cargo_intake) "kCN" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ pixel_y = 16 }, /obj/item/trash/plate, @@ -32795,7 +32795,7 @@ /area/lv522/indoors/a_block/dorms) "mZK" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ pixel_x = 16; pixel_y = 7 }, @@ -54626,7 +54626,7 @@ "val" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ dir = 1; pixel_y = 3 }, diff --git a/maps/map_files/USS_Almayer/USS_Almayer.dmm b/maps/map_files/USS_Almayer/USS_Almayer.dmm index 4f0b8de4d810..8ccad6d6cca2 100644 --- a/maps/map_files/USS_Almayer/USS_Almayer.dmm +++ b/maps/map_files/USS_Almayer/USS_Almayer.dmm @@ -19953,7 +19953,7 @@ /area/almayer/living/grunt_rnr) "cDH" = ( /obj/effect/decal/cleanable/dirt, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ pixel_y = 29 }, /turf/open/floor/almayer{ @@ -62101,7 +62101,7 @@ /area/almayer/engineering/lower/engine_core) "rjV" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ dir = 8; layer = 3.2; pixel_x = -3; @@ -81663,7 +81663,7 @@ }, /area/almayer/shipboard/panic) "xML" = ( -/obj/structure/machinery/computer/cameras/wooden_tv/prop{ +/obj/structure/machinery/computer/cameras/wooden_tv/broadcast{ pixel_x = -4; pixel_y = 2 },