From 36be326da7831d6eabcb99289e7644624bf3c061 Mon Sep 17 00:00:00 2001 From: Uristqwerty Date: Fri, 18 May 2012 22:27:26 -0400 Subject: [PATCH 1/2] This might fix Issue #1048 --- code/WorkInProgress/AI_Visibility.dm | 6 ------ code/modules/mob/living/silicon/ai/ai.dm | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/code/WorkInProgress/AI_Visibility.dm b/code/WorkInProgress/AI_Visibility.dm index a51e04b0cd6..00e090c221e 100644 --- a/code/WorkInProgress/AI_Visibility.dm +++ b/code/WorkInProgress/AI_Visibility.dm @@ -368,12 +368,6 @@ var/datum/cameranet/cameranet = new() return 1 return 0 -/mob/living/silicon/ai/switchCamera(var/obj/machinery/camera/C) - if(C && isturf(C.loc)) - eyeobj.loc = C.loc - cameranet.visibility(eyeobj) - return - /mob/living/silicon/ai/attack_ai(var/mob/user as mob) if (user != src) return diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index a5649e336ce..17bad9ef72d 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -441,6 +441,7 @@ if(client.eye == eyeobj) eyeobj.loc = C.loc + cameranet.visibility(eyeobj) else machine = src src:current = C From b6e4da901a218ced7500128c765dcb08b4f6609f Mon Sep 17 00:00:00 2001 From: Uristqwerty Date: Sat, 19 May 2012 02:23:37 -0400 Subject: [PATCH 2/2] Things are more complicated than they seemed at first... ... but I think I got it. Also fixed (hopefully) a number of other AI viewing bugs. --- code/WorkInProgress/AI_Visibility.dm | 20 ++++++++++++++++++-- code/game/machinery/camera.dm | 21 ++++++++++++++------- code/modules/mob/living/silicon/ai/ai.dm | 4 +++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/code/WorkInProgress/AI_Visibility.dm b/code/WorkInProgress/AI_Visibility.dm index 00e090c221e..a18da5b5f43 100644 --- a/code/WorkInProgress/AI_Visibility.dm +++ b/code/WorkInProgress/AI_Visibility.dm @@ -301,6 +301,7 @@ var/datum/cameranet/cameranet = new() // machine = null if(!eyeobj) //if it got deleted somehow (like an admin trying to fix things <.<') eyeobj = new() + eyeobj.ai = src client.eye = eyeobj eyeobj.loc = loc cameranet.visibility(eyeobj) @@ -405,5 +406,20 @@ var/datum/cameranet/cameranet = new() set category = "OOC" reset_view(null) machine = null - del eyeobj - src.freelook() + +/mob/living/silicon/ai/reset_view(atom/A) + if (client) + if(!eyeobj) + eyeobj = new() + eyeobj.ai = src + + client.eye = eyeobj + client.perspective = EYE_PERSPECTIVE + + if (istype(A, /atom/movable)) + eyeobj.loc = locate(A.x, A.y, A.z) + + else + eyeobj.loc = locate(src.x, src.y, src.z) + + cameranet.visibility(eyeobj) \ No newline at end of file diff --git a/code/game/machinery/camera.dm b/code/game/machinery/camera.dm index a30f5560bef..a6cf27724a1 100644 --- a/code/game/machinery/camera.dm +++ b/code/game/machinery/camera.dm @@ -98,19 +98,15 @@ usr:cameraFollow = target usr << "Now tracking target on camera." //Unidentifieds are no longer screamed at you. - if (usr.machine == null) + + if (usr.machine == null && client.eye != eyeobj) usr.machine = usr spawn (0) - if(client.eye == eyeobj) - if(checkcameravis(target)) - eyeobj.loc = target.loc - else - usr << "Target is not on or near any active cameras on the station." - return while (usr:cameraFollow == target) if (usr:cameraFollow == null) return + else if (istype(target, /mob/living/carbon/human)) if(istype(target:wear_id, /obj/item/weapon/card/id/syndicate)) usr << "Follow camera mode terminated." @@ -134,6 +130,17 @@ sleep(40) //because we're sleeping another second after this (a few lines down) continue + else if(client.eye == eyeobj) + if(checkcameravis(target)) + eyeobj.loc = target.loc + sleep(50) + continue + + else + usr << "Target is not on or near any active cameras on the station." + usr:cameraFollow = null + return + var/obj/machinery/camera/C = usr:current if ((C && istype(C, /obj/machinery/camera)) || C==null) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 17bad9ef72d..a59fdb7d13d 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -579,7 +579,9 @@ if(C.network == newnet) cameralist.Add(C) - switchCamera( pick(cameralist) ) + if(length(cameralist)) + switchCamera( pick(cameralist) ) + src << "\blue Jumped to [newnet] camera network." //End of code by Mord_Sith //cael - with the multiple onstation networks all linked together, changing networks is legacy functionality