diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 54098f078c..8f28c4b4e9 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -59,6 +59,8 @@ ..() if (old != stat) update_icon() + if (stat & NOPOWER) + kick_viewers() /obj/machinery/camera/update_icon() if (!status || (stat & NOPOWER)) @@ -85,13 +87,7 @@ cancelCameraAlarm() if(can_use()) cameranet.addCamera(src) - for(var/mob/O in mob_list) - if (istype(O.machine, /obj/machinery/computer/security)) - var/obj/machinery/computer/security/S = O.machine - if (S.current == src) - O.unset_machine() - O.reset_view(null) - O << "The screen bursts into static." + kick_viewers() ..() @@ -207,6 +203,10 @@ // now disconnect anyone using the camera //Apparently, this will disconnect anyone even if the camera was re-activated. //I guess that doesn't matter since they can't use it anyway? + kick_viewers() + +//This might be redundant, because of check_eye() +/obj/machinery/camera/proc/kick_viewers() for(var/mob/O in player_list) if (istype(O.machine, /obj/machinery/computer/security)) var/obj/machinery/computer/security/S = O.machine diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index fae3453aaa..21a9dc1061 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -58,7 +58,7 @@ /obj/machinery/camera/proc/isXRay() var/obj/item/weapon/stock_parts/scanning_module/O = locate(/obj/item/weapon/stock_parts/scanning_module) in assembly.upgrades - if (O.rating >= 2) + if (O && O.rating >= 2) return O return null diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 13dd68d584..ef434955a1 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -21,8 +21,10 @@ check_eye(var/mob/user as mob) - if ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded || !( current ) || !( current.status )) && (!istype(user, /mob/living/silicon))) + if (user.stat || ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded) && !istype(user, /mob/living/silicon))) //user can't see - not sure why canmove is here. return null + if ( !current || !current.can_use() ) //camera doesn't work + current = null user.reset_view(current) return 1 @@ -46,7 +48,7 @@ D["Cancel"] = "Cancel" for(var/obj/machinery/camera/C in L) if(can_access_camera(C)) - D[text("[][]", C.c_tag, (C.status ? null : " (Deactivated)"))] = C + D[text("[][]", C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C var/t = input(user, "Which camera should you change to?") as null|anything in D if(!t) @@ -72,19 +74,18 @@ return 0 proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C) - if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.can_use() )) && (!istype(user, /mob/living/silicon/ai))) - if(!C.can_use() && !isAI(user)) - src.current = null - return 0 - else - if(isAI(user)) - var/mob/living/silicon/ai/A = user - A.eyeobj.setLoc(get_turf(C)) - A.client.eye = A.eyeobj - else - src.current = C - use_power(50) + //don't need to check if the camera works for AI because the AI jumps to the camera location and doesn't actually look through cameras. + if(isAI(user)) + var/mob/living/silicon/ai/A = user + A.eyeobj.setLoc(get_turf(C)) + A.client.eye = A.eyeobj return 1 + + if (!C.can_use() || user.stat || (get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) && !istype(user, /mob/living/silicon))) + return 0 + src.current = C + use_power(50) + return 1 //Camera control: moving. proc/jump_on_click(var/mob/user,var/A) diff --git a/code/game/machinery/computer/camera_monitor.dm b/code/game/machinery/computer/camera_monitor.dm index c8f3b7b348..11e8ddd43c 100644 --- a/code/game/machinery/computer/camera_monitor.dm +++ b/code/game/machinery/computer/camera_monitor.dm @@ -40,7 +40,7 @@ D["Cancel"] = "Cancel" for (var/obj/machinery/camera/C in L) if ( C.network in src.networks ) - D[text("[]: [][]", C.network, C.c_tag, (C.status ? null : " (Deactivated)"))] = C + D[text("[]: [][]", C.network, C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C var/t = input(user, "Which camera should you change to?") as null|anything in D