From 399a5080dae4abe07840a18f2e82cc21a964da40 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 21 Nov 2019 04:42:49 +0100 Subject: [PATCH 1/2] Fixing cyborg camera interaction for real --- code/game/machinery/computer/camera.dm | 49 ++++++++++---------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 11935e2bfc..5d63264363 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -17,13 +17,7 @@ network += lowertext(i) /obj/machinery/computer/security/check_eye(mob/user) - if(CHECK_BITFIELD(stat, NOPOWER|BROKEN) || is_blind(user) || !in_view_range(user, src) || !user.canUseTopic(src, !issilicon(user), FALSE)) - user.unset_machine() - return - if(!(user in watchers)) - user.unset_machine() - return - if(!watchers[user]) + if(!can_interact(user) || !(user in watchers) || !watchers[user]) user.unset_machine() return var/obj/machinery/camera/C = watchers[user] @@ -41,55 +35,50 @@ M.unset_machine() //to properly reset the view of the users if the console is deleted. return ..() -/obj/machinery/computer/security/attack_hand(mob/user) +/obj/machinery/computer/security/can_interact(mob/user) + if(is_blind(user) || !in_view_range(user, src)) + return FALSE + return ..() + +/obj/machinery/computer/security/interact(mob/user, special_state) . = ..() - if(.) - return - if(stat) + if (ismob(user) && !isliving(user)) // ghosts don't need cameras return if (!network) - throw EXCEPTION("No camera network") + CRASH("No camera network") user.unset_machine() - return + return FALSE if (!(islist(network))) - throw EXCEPTION("Camera network is not a list") + CRASH("Camera network is not a list") user.unset_machine() - return - if(..()) - user.unset_machine() - return + return FALSE var/list/camera_list = get_available_cameras() if(!(user in watchers)) for(var/Num in camera_list) var/obj/machinery/camera/CAM = camera_list[Num] - if(istype(CAM)) - if(CAM.can_use()) - watchers[user] = CAM //let's give the user the first usable camera, and then let him change to the camera he wants. - break + if(istype(CAM) && CAM.can_use()) + watchers[user] = CAM //let's give the user the first usable camera, and then let him change to the camera he wants. + break if(!(user in watchers)) user.unset_machine() // no usable camera on the network, we disconnect the user from the computer. - return + return FALSE playsound(src, 'sound/machines/terminal_prompt.ogg', 25, 0) use_camera_console(user) /obj/machinery/computer/security/proc/use_camera_console(mob/user) var/list/camera_list = get_available_cameras() var/t = input(user, "Which camera should you change to?") as null|anything in camera_list - if(user.machine != src) //while we were choosing we got disconnected from our computer or are using another machine. + if(!src || user.machine != src) //while we were choosing we got disconnected from our computer or are using another machine. return - if(!t) + if(!t || t == "Cancel") user.unset_machine() playsound(src, 'sound/machines/terminal_off.ogg', 25, 0) return var/obj/machinery/camera/C = camera_list[t] - if(t == "Cancel") - user.unset_machine() - playsound(src, 'sound/machines/terminal_off.ogg', 25, 0) - return - if(!C || !C.can_use() || CHECK_BITFIELD(stat, NOPOWER|BROKEN) || is_blind(user) || !in_view_range(user, src) || !user.canUseTopic(src, !issilicon(user), FALSE)) + if(!C || !C.can_use() || !can_interact(user)) user.unset_machine() return FALSE From 2e55495557d635805706fcb508bd7253f7b64e37 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Thu, 21 Nov 2019 04:48:42 +0100 Subject: [PATCH 2/2] ayy --- code/game/machinery/computer/camera.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 5d63264363..1bafa73aaa 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -36,7 +36,7 @@ return ..() /obj/machinery/computer/security/can_interact(mob/user) - if(is_blind(user) || !in_view_range(user, src)) + if((!issilicon(user) && !Adjacent(user)) || is_blind(user) || !in_view_range(user, src)) return FALSE return ..()