Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low effort broadcasting #6078

Merged
merged 22 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
42 changes: 40 additions & 2 deletions code/game/machinery/computer/camera_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/vending/vendor_types/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/items/circuitboards/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions code/modules/paperwork/photography.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 6 additions & 6 deletions maps/map_files/LV522_Chances_Claim/LV522_Chances_Claim.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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
},
Expand Down
6 changes: 3 additions & 3 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -20104,7 +20104,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{
Expand Down Expand Up @@ -62039,7 +62039,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;
Expand Down Expand Up @@ -81554,7 +81554,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
},
Expand Down
Loading