Skip to content

Commit

Permalink
Camera Bullshit
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-023 committed Sep 14, 2024
1 parent 20bd788 commit bdff330
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
#define BLOCK_KNOCKDOWN (1<<11)
/// Whether wearing this suit grants you the ability to fire a smartgun
#define SMARTGUN_HARNESS (1<<12)
///Whether wearing this headset grants you the ability to use the IFF targetting system of the smartgun
#define SMARTGUN_OPTIC (1<<13)

//SUITS AND HELMETS====================================================================================

Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ DEFINE_BITFIELD(flags_inventory, list(
"NOPRESSUREDMAGE" = NOPRESSUREDMAGE,
"BLOCK_KNOCKDOWN" = BLOCK_KNOCKDOWN,
"SMARTGUN_HARNESS" = SMARTGUN_HARNESS,
"SMARTGUN_OPTIC" = SMARTGUN_OPTIC,
))

DEFINE_BITFIELD(flags_jumpsuit, list(
Expand Down
4 changes: 4 additions & 0 deletions code/game/camera_manager/camera_manager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
var/obj/item/clothing/clothing = current.loc
cam_location = clothing.loc

else if(istype(current.loc, /obj/item/device/overwatch_camera))
var/obj/item/device/overwatch_camera/cam_gear = current.loc
cam_location = cam_gear.loc

// 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.
Expand Down
4 changes: 4 additions & 0 deletions code/game/machinery/camera/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,7 @@ GLOBAL_LIST_EMPTY_TYPED(all_cameras, /obj/structure/machinery/camera)

/obj/structure/machinery/camera/cas/isXRay()
return TRUE

/obj/structure/machinery/camera/overwatch
name = "overwatch camera"
network = list(CAMERA_NET_OVERWATCH)
12 changes: 12 additions & 0 deletions code/modules/clothing/glasses/night.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,27 @@
toggleable = TRUE
actions_types = list(/datum/action/item_action/toggle, /datum/action/item_action/m56_goggles/far_sight)
vision_flags = SEE_TURFS
flags_inventory = SMARTGUN_OPTIC
fullscreen_vision = null
eye_protection = EYE_PROTECTION_FLAVOR
req_skill = SKILL_SPEC_WEAPONS
req_skill_level = SKILL_SPEC_SMARTGUN
var/obj/structure/machinery/camera/camera

var/far_sight = FALSE
var/obj/item/weapon/gun/smartgun/linked_smartgun = null

/obj/item/clothing/glasses/night/m56_goggles/Initialize(mapload)
. = ..()
camera = new /obj/structure/machinery/camera/overwatch

/obj/item/clothing/glasses/night/m56_goggles/equipped(mob/living/carbon/human/mob, slot)
if(camera)
camera.c_tag = mob.name
..()

/obj/item/clothing/glasses/night/m56_goggles/Destroy()
QDEL_NULL(camera)
linked_smartgun = null
disable_far_sight()
return ..()
Expand Down
3 changes: 1 addition & 2 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
pockets.bypass_w_limit = GLOB.allowed_helmet_items
pockets.max_storage_space = storage_max_storage_space

camera = new /obj/structure/machinery/camera(src)
camera.network = list(CAMERA_NET_OVERWATCH)
camera = new /obj/structure/machinery/camera/overwatch

for(var/obj/visor as anything in built_in_visors)
visor.forceMove(src)
Expand Down
34 changes: 34 additions & 0 deletions code/modules/cm_marines/equipment/gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,37 @@
new /obj/item/reagent_container/food/snacks/cookie(src)
if(5)
new /obj/item/reagent_container/food/snacks/chocolatebar(src)

/obj/item/device/overwatch_camera
name = "M5 Camera Gear"
desc = "A camera and associated headgear designed to allow marine commanders to see what their troops can see. A more robust version of this equipment is integrated into all standard USCM combat helmets."
icon = 'icons/obj/items/clothing/glasses.dmi'
icon_state = "overwatch_gear"
item_icons = list(
WEAR_L_EAR = 'icons/mob/humans/onmob/ears.dmi',
WEAR_R_EAR = 'icons/mob/humans/onmob/ears.dmi',
)
item_state_slots = list(
WEAR_L_EAR = "cam_gear",
WEAR_R_EAR = "cam_gear",
)
flags_equip_slot = SLOT_EAR
var/obj/structure/machinery/camera/camera

/obj/item/device/overwatch_camera/Initialize(mapload, ...)
. = ..()
camera = new /obj/structure/machinery/camera/overwatch(src)

/obj/item/device/overwatch_camera/Destroy()
QDEL_NULL(camera)
return ..()

/obj/item/device/overwatch_camera/equipped(mob/living/carbon/human/mob, slot)
if(camera)
camera.c_tag = mob.name
..()

/obj/item/device/overwatch_camera/dropped(mob/user)
if(camera)
camera.c_tag = "Unknown"
..()
34 changes: 27 additions & 7 deletions code/modules/cm_marines/overwatch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
if(mob_state == "Conscious" && (locate(/datum/effects/crit) in marine_human.effects_list))
mob_state = "Incapacitated"

if(!istype(marine_human.head, /obj/item/clothing/head/helmet/marine))
if(!marine_has_camera(marine_human))
has_helmet = FALSE

if(!marine_human.key || !marine_human.client)
Expand Down Expand Up @@ -652,13 +652,33 @@
cam = null
user.reset_view(null)

//returns the helmet camera the human is wearing
/obj/structure/machinery/computer/overwatch/proc/get_camera_from_target(mob/living/carbon/human/H)
/// checks if the human has an overwatch camera at all
/obj/structure/machinery/computer/overwatch/proc/marine_has_camera(mob/living/carbon/human/marine)
if(istype(marine.head, /obj/item/clothing/head/helmet/marine))
return TRUE
if(istype(marine.wear_l_ear, /obj/item/device/overwatch_camera) || istype(marine.wear_r_ear, /obj/item/device/overwatch_camera))
return TRUE
if(istype(marine.glasses, /obj/item/clothing/glasses/night/m56_goggles))
return TRUE
return FALSE
/// returns the overwatch camera the human is wearing
/obj/structure/machinery/computer/overwatch/proc/get_camera_from_target(mob/living/carbon/human/marine)
if(current_squad)
if(H && istype(H) && istype(H.head, /obj/item/clothing/head/helmet/marine))
var/obj/item/clothing/head/helmet/marine/helm = H.head
return helm.camera

if(marine && istype(marine))
if(istype(marine.head, /obj/item/clothing/head/helmet/marine))
var/obj/item/clothing/head/helmet/marine/helm = marine.head
return helm.camera
var/obj/item/device/overwatch_camera/cam_gear
if(istype(marine.wear_l_ear, /obj/item/device/overwatch_camera))
cam_gear = marine.wear_l_ear
return cam_gear.camera
if(istype(marine.wear_r_ear, /obj/item/device/overwatch_camera))
cam_gear = marine.wear_r_ear
return cam_gear.camera
var/obj/item/clothing/glasses/night/m56_goggles/m56_cam
if(istype(marine.glasses, /obj/item/clothing/glasses/night/m56_goggles))
m56_cam = marine.glasses
return m56_cam.camera

// Alerts all groundside marines about the incoming OB
/obj/structure/machinery/computer/overwatch/proc/alert_ob(turf/target)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/guns/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@
to_chat(H, SPAN_WARNING("You can't fire \the [src] with the feed cover open! (alt-click to close)"))
balloon_alert(user, "cannot fire; feed cover open")
return FALSE
if(iff_enabled)
if(!H.glasses || !(H.glasses.flags_inventory & SMARTGUN_OPTIC))
balloon_alert(user, "m56 headset required for iff tracking")
return FALSE

/obj/item/weapon/gun/smartgun/unique_action(mob/user)
if(isobserver(usr) || isxeno(usr))
Expand Down
Binary file modified icons/mob/humans/onmob/ears.dmi
Binary file not shown.
Binary file modified icons/obj/items/clothing/glasses.dmi
Binary file not shown.

0 comments on commit bdff330

Please sign in to comment.