From 7c89863c017b2664c36f5b3e79b8959ff46acb26 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:14:37 +0300 Subject: [PATCH] [MIRROR] Fixes a runtime in advanced camera console [MDB IGNORE] (#843) * Fixes a runtime in advanced camera console (#79938) --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@ users.noreply.github.com> --- code/game/machinery/computer/camera_advanced.dm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index 4750feb3b9b..a2b1b30183b 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -74,17 +74,18 @@ CRASH("[type] does not implement ai eye handling") /obj/machinery/computer/camera_advanced/remove_eye_control(mob/living/user) - if(!user) + if(isnull(user?.client)) return + for(var/datum/action/actions_removed as anything in actions) actions_removed.Remove(user) for(var/datum/camerachunk/camerachunks_gone as anything in eyeobj.visibleCameraChunks) camerachunks_gone.remove(eyeobj) - if(user.client) - user.reset_perspective(null) - if(eyeobj.visible_icon && user.client) - user.client.images -= eyeobj.user_image - user.client.view_size.unsupress() + + user.reset_perspective(null) + if(eyeobj.visible_icon) + user.client.images -= eyeobj.user_image + user.client.view_size.unsupress() eyeobj.eye_user = null user.remote_control = null @@ -121,6 +122,8 @@ return if(!can_use(user)) return + if(isnull(user.client)) + return if(current_user) to_chat(user, span_warning("The console is already in use!")) return @@ -165,6 +168,8 @@ return //AIs would need to disable their own camera procs to use the console safely. Bugs happen otherwise. /obj/machinery/computer/camera_advanced/proc/give_eye_control(mob/user) + if(isnull(user?.client)) + return GrantActions(user) current_user = user eyeobj.eye_user = user