mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Re-implemented Spess.TV cameras (#31086)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
layer = PLATING_PLANE
|
||||
plane = PLATING_PLANE
|
||||
globalscreen = TRUE
|
||||
icon = null
|
||||
|
||||
/**
|
||||
* A generic background object.
|
||||
|
||||
@@ -121,6 +121,7 @@ var/list/obj/machinery/camera/cyborg_cams = list(
|
||||
|
||||
/obj/machinery/computer/security/ui_static_data()
|
||||
var/list/data = list()
|
||||
data["title"] = name
|
||||
data["mapRef"] = map_name
|
||||
var/list/cameras = get_available_cameras()
|
||||
data["cameras"] = list()
|
||||
@@ -158,20 +159,17 @@ var/list/obj/machinery/camera/cyborg_cams = list(
|
||||
|
||||
var/list/visible_turfs = list()
|
||||
|
||||
// Is this camera located in or attached to a living thing? If so, assume the camera's loc is the living thing.
|
||||
var/cam_location = isliving(active_camera.loc) ? active_camera.loc : active_camera
|
||||
|
||||
// If we're not forcing an update for some reason and the cameras are in the same location,
|
||||
// we don't need to update anything.
|
||||
// Most security cameras will end here as they're not moving.
|
||||
var/newturf = get_turf(cam_location)
|
||||
var/newturf = get_turf(active_camera)
|
||||
if(last_camera_turf == newturf)
|
||||
return
|
||||
|
||||
// Cameras that get here are moving, and are likely attached to some moving atom such as cyborgs.
|
||||
last_camera_turf = get_turf(cam_location)
|
||||
last_camera_turf = get_turf(newturf)
|
||||
|
||||
var/list/visible_things = active_camera.isXRay() ? range(active_camera.view_range, cam_location) : view(active_camera.view_range, cam_location)
|
||||
var/list/visible_things = active_camera.isXRay() ? range(active_camera.view_range, newturf) : view(active_camera.view_range, newturf)
|
||||
|
||||
for(var/turf/visible_turf in visible_things)
|
||||
visible_turfs += visible_turf
|
||||
@@ -235,6 +233,28 @@ var/list/obj/machinery/camera/cyborg_cams = list(
|
||||
network = list(CAMERANET_SPESSTV)
|
||||
density = TRUE
|
||||
|
||||
/obj/machinery/computer/security/telescreen/entertainment/spesstv/ui_act(action, list/params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
switch(action)
|
||||
if("follow")
|
||||
var/obj/machinery/camera/arena/spesstv/camera = active_camera
|
||||
if(!istype(camera))
|
||||
return
|
||||
var/datum/role/streamer/streamer_role = camera.streamer
|
||||
if(!istype(streamer_role))
|
||||
return
|
||||
streamer_role.try_add_follower(usr.mind)
|
||||
if("subscribe")
|
||||
var/obj/machinery/camera/arena/spesstv/camera = active_camera
|
||||
if(!istype(camera))
|
||||
return
|
||||
var/datum/role/streamer/streamer_role = camera.streamer
|
||||
if(!istype(streamer_role))
|
||||
return
|
||||
streamer_role.try_add_subscription(usr.mind, src)
|
||||
|
||||
/obj/machinery/computer/security/telescreen/entertainment/spesstv/is_operational()
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ export const CameraConsole = (props, context) => {
|
||||
] = prevNextCamera(cameras, activeCamera);
|
||||
return (
|
||||
<Window
|
||||
title={data.title}
|
||||
width={870}
|
||||
height={708}>
|
||||
<div className="CameraConsole__left">
|
||||
@@ -65,6 +66,18 @@ export const CameraConsole = (props, context) => {
|
||||
|| '—'}
|
||||
</div>
|
||||
<div className="CameraConsole__toolbarRight">
|
||||
<Button
|
||||
icon="heart"
|
||||
disabled={!activeCamera}
|
||||
onClick={() => act('follow')}>
|
||||
Follow
|
||||
</Button>
|
||||
<Button
|
||||
icon="star"
|
||||
disabled={!activeCamera}
|
||||
onClick={() => act('subscribe')}>
|
||||
Subscribe
|
||||
</Button>
|
||||
<Button
|
||||
icon="chevron-left"
|
||||
disabled={!prevCameraName}
|
||||
@@ -112,8 +125,7 @@ export const CameraConsoleContent = (props, context) => {
|
||||
<Flex.Item
|
||||
height="100%">
|
||||
<Section
|
||||
fill
|
||||
scrollable>
|
||||
fill>
|
||||
{cameras.map(camera => (
|
||||
// We're not using the component here because performance
|
||||
// would be absolutely abysmal (50+ ms for each re-render).
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user