Mech camera (#71392)

## About The Pull Request
This PR implements a new add-on for mechs that functions as a
~~EMP-proof~~ borg security camera. Unlocked in Basic Robotics Research
node.
Mechs with a camera installed will have a unique diagnostic HUD blip.


![image](https://user-images.githubusercontent.com/75863639/202909177-f2badafc-2429-495f-a281-fcaad95837fb.png)

Getting EMPd temporarily sets the camera's view range to 1.


![image](https://user-images.githubusercontent.com/75863639/203862438-cfcdc442-3aa6-4468-83bb-b4ccad8dfa2e.png)


## Why It's Good For The Game
Bodycam footage of the mech in action; AIs piloting a mech with this
add-on can actually see what's happening around the mech, much like
following a borg.

## Changelog
🆑
add: robotics now has access to a mech camera add-on, which installs a
security camera into the mech. bodycam footage from the big leagues!
qol: cyborg cameras should be more active with updating static when
moving (ideally down from 2.5 seconds to 0.5 between updates), make sure
to report any jank if you happen on some
/🆑

Co-authored-by: Time-Green <timkoster1@hotmail.com>
This commit is contained in:
Sealed101
2022-11-30 00:21:23 +03:00
committed by GitHub
parent 57d8a1bddd
commit 60b47e2bd5
17 changed files with 207 additions and 49 deletions
@@ -137,24 +137,25 @@
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
// Get the camera's turf to correctly gather what's visible from it's turf, in case it's located in a moving object (borgs / mechs)
var/new_cam_turf = get_turf(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)
if(last_camera_turf == newturf)
if(last_camera_turf == new_cam_turf)
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 = new_cam_turf
var/list/visible_things = active_camera.isXRay() ? range(active_camera.view_range, cam_location) : view(active_camera.view_range, cam_location)
//Here we gather what's visible from the camera's POV based on its view_range and xray modifier if present
var/list/visible_things = active_camera.isXRay() ? range(active_camera.view_range, new_cam_turf) : view(active_camera.view_range, new_cam_turf)
for(var/turf/visible_turf in visible_things)
visible_turfs += visible_turf
//Get coordinates for a rectangle area that contains the turfs we see so we can then clear away the static in the resulting rectangle area
var/list/bbox = get_bbox_of_atoms(visible_turfs)
var/size_x = bbox[3] - bbox[1] + 1
var/size_y = bbox[4] - bbox[2] + 1
@@ -172,7 +173,9 @@
/datum/computer_file/program/secureye/proc/get_available_cameras()
var/list/L = list()
for (var/obj/machinery/camera/cam as anything in GLOB.cameranet.cameras)
if(!is_station_level(cam.z))//Only show station cameras.
//Get the camera's turf in case it's inside something like a borg
var/turf/camera_turf = get_turf(cam)
if(!is_station_level(camera_turf.z))//Only show station cameras.
continue
L.Add(cam)
var/list/camlist = list()