From 07c8ebcff78025689db55100c3ce9187fc9ed00b Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 30 Aug 2014 09:58:10 -0400 Subject: [PATCH 1/3] Fixes #6224 --- code/game/machinery/camera/presets.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 630a722ce36006cba9516ceb0a397709f05995de Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 30 Aug 2014 13:10:17 -0400 Subject: [PATCH 2/3] Fixes being able to look through disabled cameras check_eye() was checking status instead of can_use(). --- code/game/machinery/camera/camera.dm | 14 +++++++------- code/game/machinery/computer/camera.dm | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) 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/computer/camera.dm b/code/game/machinery/computer/camera.dm index 13dd68d584..5f73f84cf5 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -21,7 +21,7 @@ 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 ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded || !( current ) || !( current.can_use() )) && (!istype(user, /mob/living/silicon))) return null user.reset_view(current) return 1 @@ -46,7 +46,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) From cfc20ffe7b06334c51492181b9e6321f71ce0b5b Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 30 Aug 2014 13:44:37 -0400 Subject: [PATCH 3/3] Fixes silicon mobs bypassing can_use() check --- code/game/machinery/computer/camera.dm | 27 ++++++++++--------- .../game/machinery/computer/camera_monitor.dm | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 5f73f84cf5..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.can_use() )) && (!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 @@ -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