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

Ports Bodycameras from Fulp #2982

Closed
wants to merge 14 commits into from
10 changes: 6 additions & 4 deletions _maps/shuttles/independent/independent_mudskipper.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@
/obj/item/gun/energy/laser/e10,
/obj/item/stock_parts/cell/gun,
/obj/item/stock_parts/cell/gun,
/obj/item/bodycam,
/obj/item/bodycam,
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
"ot" = (
Expand Down Expand Up @@ -750,17 +752,17 @@
/obj/effect/turf_decal/corner/transparent/neutral{
dir = 4
},
/obj/machinery/computer/crew{
dir = 8;
icon_state = "computer-right"
},
/obj/machinery/button/door{
dir = 1;
pixel_x = -6;
pixel_y = -21;
name = "Bridge Lockdown";
id = "mudskipper_bridge"
},
/obj/machinery/computer/security{
dir = 8;
icon_state = "computer-right"
},
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
"qE" = (
Expand Down
4 changes: 3 additions & 1 deletion _maps/shuttles/independent/independent_rigger.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@
pixel_x = 8;
pixel_y = 12
},
/obj/item/bodycam,
/turf/open/floor/plasteel/grimy,
/area/ship/security)
"mD" = (
Expand Down Expand Up @@ -3012,7 +3013,7 @@
/area/ship/crew)
"JE" = (
/obj/effect/turf_decal/industrial/outline/yellow,
/obj/machinery/computer/crew,
/obj/machinery/computer/security,
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
"JF" = (
Expand Down Expand Up @@ -4121,6 +4122,7 @@
/obj/item/clothing/suit/toggle/hazard,
/obj/item/clothing/head/hardhat/mining,
/obj/effect/turf_decal/industrial/outline/yellow,
/obj/item/bodycam,
/turf/open/floor/plasteel/tech/techmaint,
/area/ship/hallway/central)
"WE" = (
Expand Down
2 changes: 2 additions & 0 deletions _maps/shuttles/independent/independent_shetland.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,8 @@
/obj/item/clothing/glasses/cheapsuns,
/obj/item/melee/classic_baton,
/obj/effect/decal/cleanable/dirt,
/obj/item/bodycam,
/obj/item/bodycam,
/turf/open/floor/plasteel/dark,
/area/ship/security)
"pX" = (
Expand Down
5 changes: 3 additions & 2 deletions _maps/shuttles/inteq/inteq_talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3419,10 +3419,10 @@
},
/obj/item/gun/ballistic/shotgun/bulldog/inteq/no_mag{
pixel_x = -8;
pixel_y = 8;
pixel_y = 8
},
/obj/item/gun/ballistic/shotgun/bulldog/inteq/no_mag{
pixel_x = -12;
pixel_x = -12
},
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
Expand Down Expand Up @@ -7508,6 +7508,7 @@
/obj/item/clothing/glasses/hud/security/sunglasses/inteq,
/obj/item/storage/box/handcuffs,
/obj/item/storage/belt/security/webbing/inteq/alt,
/obj/item/storage/box/bodycams,
/turf/open/floor/plasteel/tech/grid,
/area/ship/security/armory)
"Ya" = (
Expand Down
1 change: 1 addition & 0 deletions _maps/shuttles/nanotrasen/nanotrasen_osprey.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/obj/item/gun/ballistic/automatic/pistol/commander/no_mag,
/obj/item/gun/energy/e_gun/mini,
/obj/item/gun/energy/e_gun/mini,
/obj/item/storage/box/bodycams,
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
"aj" = (
Expand Down
4 changes: 4 additions & 0 deletions _maps/shuttles/nanotrasen/nanotrasen_ranger.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
/obj/item/pinpointer/crew,
/obj/item/storage/box/bodybags,
/obj/item/storage/firstaid/regular,
/obj/item/bodycam,
/turf/open/floor/wood,
/area/ship/medical)
"aP" = (
Expand Down Expand Up @@ -193,6 +194,7 @@
/obj/item/ammo_box/magazine/co9mm,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/storage/belt/security/webbing,
/obj/item/bodycam,
/turf/open/floor/wood,
/area/ship/security)
"bD" = (
Expand Down Expand Up @@ -1555,6 +1557,7 @@
/obj/item/clothing/glasses/meson/gar{
pixel_y = 8
},
/obj/item/bodycam,
/turf/open/floor/plasteel/mono/dark,
/area/ship/engineering)
"pA" = (
Expand Down Expand Up @@ -3137,6 +3140,7 @@
/obj/item/ammo_box/c9mm/rubbershot,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/ammo_box/magazine/co9mm,
/obj/item/bodycam,
/turf/open/floor/wood,
/area/ship/crew/dorm)
"Hd" = (
Expand Down
1 change: 1 addition & 0 deletions _maps/shuttles/pgf/pgf_crying_sun.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2443,6 +2443,7 @@
pixel_x = 8;
pixel_y = 0
},
/obj/item/storage/box/bodycams,
/turf/open/floor/vault,
/area/ship/security/armory)
"vr" = (
Expand Down
1 change: 1 addition & 0 deletions _maps/shuttles/solgov/solgov_chronicle.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,7 @@
/obj/item/pen/solgov{
pixel_x = -5
},
/obj/item/storage/box/bodycams,
/turf/open/floor/wood/walnut,
/area/ship/bridge)
"tV" = (
Expand Down
13 changes: 9 additions & 4 deletions _maps/shuttles/syndicate/syndicate_gorlex_hyena.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,9 @@
/obj/effect/decal/cleanable/dirt/dust,
/obj/structure/table,
/obj/effect/turf_decal/industrial/outline,
/obj/item/storage/box/bodycams{
pixel_y = 17
},
/turf/open/floor/mineral/plastitanium/red,
/area/ship/security/armory)
"wO" = (
Expand Down Expand Up @@ -3032,12 +3035,13 @@
"Xj" = (
/obj/effect/decal/cleanable/dirt,
/obj/effect/decal/cleanable/dirt/dust,
/obj/machinery/computer/crew{
dir = 8
},
/obj/effect/turf_decal/borderfloorblack{
dir = 4
},
/obj/machinery/computer/security{
dir = 8;
icon_state = "computer-left"
},
/turf/open/floor/plasteel/tech/grid,
/area/ship/cargo/office)
"Xz" = (
Expand Down Expand Up @@ -3259,7 +3263,8 @@
/obj/machinery/firealarm/directional/south,
/obj/effect/decal/cleanable/dirt/dust,
/obj/machinery/computer/rdconsole/core{
dir = 8
dir = 8;
icon_state = "computer-right"
},
/obj/effect/turf_decal/borderfloorblack{
dir = 4
Expand Down
3 changes: 3 additions & 0 deletions _maps/shuttles/syndicate/syndicate_gorlex_komodo.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,9 @@
},
/obj/machinery/airalarm/directional/west,
/obj/item/radio/intercom/directional/north,
/obj/item/storage/box/bodycams{
pixel_x = 16
},
/turf/open/floor/pod/dark,
/area/ship/security/armory)
"uh" = (
Expand Down
17 changes: 12 additions & 5 deletions _maps/shuttles/syndicate/syndicate_litieguai.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,8 @@
/area/ship/cargo)
"xF" = (
/obj/machinery/computer/helm{
dir = 8
dir = 8;
icon_state = "computer-left"
},
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
Expand Down Expand Up @@ -1198,8 +1199,9 @@
/turf/open/floor/engine,
/area/ship/cargo)
"yQ" = (
/obj/machinery/computer/med_data{
dir = 8
/obj/machinery/computer/security{
dir = 8;
icon_state = "computer-right"
},
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
Expand Down Expand Up @@ -1275,6 +1277,9 @@
/obj/machinery/recharger,
/obj/machinery/light/small/directional/south,
/obj/machinery/firealarm/directional/east,
/obj/item/storage/box/bodycams{
pixel_x = -7
},
/turf/open/floor/carpet/cyan,
/area/ship/bridge)
"zo" = (
Expand Down Expand Up @@ -1518,7 +1523,8 @@
/area/ship/storage/eva)
"Ca" = (
/obj/machinery/computer/crew{
dir = 8
dir = 8;
icon_state = "computer-left"
},
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
Expand Down Expand Up @@ -2609,7 +2615,8 @@
/area/ship/hallway/central)
"TA" = (
/obj/machinery/computer/cargo/express{
dir = 8
dir = 8;
icon_state = "computer-right"
},
/turf/open/floor/plasteel/dark,
/area/ship/bridge)
Expand Down
66 changes: 66 additions & 0 deletions code/datums/components/simple_bodycam.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/// Simple component to integrate a bodycam into a mob. Ported from Fulpstation.
/datum/component/simple_bodycam
dupe_mode = COMPONENT_DUPE_SELECTIVE
/// The actual camera, in our mob's contents
VAR_PRIVATE/obj/machinery/camera/bodycam
/// How fast we update
var/camera_update_time = 0.5 SECONDS

/datum/component/simple_bodycam/Initialize(
camera_name = "bodycam",
c_tag = capitalize(camera_name),
network = "ss13",
camera_update_time = 0.5 SECONDS,
)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE

src.camera_update_time = camera_update_time

bodycam = new(parent)
bodycam.network = list(network)
bodycam.name = camera_name
bodycam.c_tag = c_tag

RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(update_cam))
RegisterSignal(parent, COMSIG_ATOM_DIR_CHANGE, PROC_REF(rotate_cam))
RegisterSignal(bodycam, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_MOVED), PROC_REF(camera_gone))

do_update_cam()

/datum/component/simple_bodycam/Destroy()
if(QDELETED(bodycam))
bodycam = null
else
QDEL_NULL(bodycam)
return ..()

/datum/component/simple_bodycam/CheckDupeComponent(
datum/component/simple_bodycam/new_bodycam, // will be null
camera_name,
c_tag,
network = "ss13",
emp_proof,
camera_update_time,
)
// Dupes are only allowed if we don't have a camera on that network already
return (network in bodycam.network)

/datum/component/simple_bodycam/proc/update_cam(datum/source, atom/old_loc, ...)
SIGNAL_HANDLER

if(get_turf(old_loc) != get_turf(parent))
do_update_cam()

/datum/component/simple_bodycam/proc/do_update_cam()
GLOB.cameranet.updatePortableCamera(bodycam, camera_update_time)

/datum/component/simple_bodycam/proc/rotate_cam(datum/source, old_dir, new_dir)
SIGNAL_HANDLER
// I don't actually think cameras care about dir but just in case
bodycam.setDir(new_dir)

/datum/component/simple_bodycam/proc/camera_gone(datum/source)
SIGNAL_HANDLER
if (!QDELETED(src))
qdel(src)
23 changes: 16 additions & 7 deletions code/game/machinery/computer/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,24 @@
if(action == "switch_camera")
var/c_tag = params["name"]
var/list/cameras = get_available_cameras()
var/obj/machinery/camera/C = cameras[c_tag]
active_camera = C
var/obj/machinery/camera/selected_camera = cameras[c_tag]
active_camera = selected_camera
playsound(src, get_sfx("terminal_type"), 25, FALSE)

// Show static if can't use the camera
if(!active_camera?.can_use())
if(!selected_camera?.can_use())
show_camera_static()
return TRUE

var/list/visible_turfs = list()
for(var/turf/T in (C.isXRay() \
? range(C.view_range, C) \
: view(C.view_range, C)))
visible_turfs += T

// 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(selected_camera.loc) ? selected_camera.loc : selected_camera

var/list/visible_things = selected_camera.isXRay() ? range(selected_camera.view_range, cam_location) : view(selected_camera.view_range, cam_location)

for(var/turf/visible_turf in visible_things)
visible_turfs += visible_turf

var/list/bbox = get_bbox_of_atoms(visible_turfs)
var/size_x = bbox[3] - bbox[1] + 1
Expand Down Expand Up @@ -193,6 +197,11 @@
D["[C.c_tag]"] = C
return D

/obj/machinery/computer/security/attackby(obj/item/bodycam/bc, mob/user, params)
bc.cameranetwork = network
user.balloon_alert(user, "body camera linked to network.")
return

Zevotech marked this conversation as resolved.
Show resolved Hide resolved
// SECURITY MONITORS

/obj/machinery/computer/security/wooden_tv
Expand Down
9 changes: 9 additions & 0 deletions code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1526,3 +1526,12 @@
)
generate_items_inside(items_inside,src)

/obj/item/storage/box/bodycams
name = "box of body cameras"
desc = "Contains four jumpsuit-mounted body cameras."
icon_state = "secbox"

/obj/item/storage/box/bodycams/PopulateContents()
for(var/i in 1 to 4)
new/obj/item/bodycam(src)

7 changes: 7 additions & 0 deletions code/modules/cargo/packs/sec_supply.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
Standard supplies
*/

/datum/supply_pack/sec_supply/bodycams
name = "Body Cameras Crate"
desc = "Contains four jumpsuit-mounted body cameras. Does not include the security camera console needed to use them."
cost = 2000
contains = list(/obj/item/storage/box/bodycams)
crate_name = "body cameras crate"

/datum/supply_pack/sec_supply/chemimp
name = "Chemical Implants Crate"
desc = "Contains five remote chemical implants."
Expand Down
Loading
Loading