From 6889d339434335af1033bb03ace24ee1fa45e134 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sun, 30 Aug 2015 17:37:44 +0200 Subject: [PATCH] Fixes the AI having X-RAY vision even when not viewing through the eye mob. Fixes #117 --- code/modules/mob/living/silicon/ai/freelook/eye.dm | 13 +++++++++++-- code/modules/mob/living/silicon/ai/life.dm | 11 ++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index 9e7864cd5a5..5a2cd67048b 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -22,8 +22,13 @@ forceEnter(destination) cameranet.visibility(src) - if(ai.client) + if(ai.client && ai.client.eye != src) // Set the eye to us and give the AI the sight & visibility flags it needs. ai.client.eye = src + ai.sight |= SEE_TURFS + ai.sight |= SEE_MOBS + ai.sight |= SEE_OBJS + ai.see_in_dark = 8 + ai.see_invisible = SEE_INVISIBLE_LEVEL_TWO //Holopad if(istype(ai.current, /obj/machinery/hologram/holopad)) @@ -142,8 +147,12 @@ src.eyeobj.name = "[src.name] (AI Eye)" // Give it a name src.eyeobj.forceMove(src.loc) - if(client && client.eye) + if(client && client.eye) // Reset these things so the AI can't view through walls and stuff. client.eye = src + sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS) + see_in_dark = 0 + see_invisible = SEE_INVISIBLE_LIVING + for(var/datum/camerachunk/c in eyeobj.visibleCameraChunks) c.remove(eyeobj) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 56a49e555d2..2292fff1f5b 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -57,11 +57,12 @@ if (!blind) //lol? if(!blind) #if(src.blind.layer) <--something here is clearly wrong :P //I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t //stage = 4.5 - src.sight |= SEE_TURFS - src.sight |= SEE_MOBS - src.sight |= SEE_OBJS - src.see_in_dark = 8 - src.see_invisible = SEE_INVISIBLE_LEVEL_TWO + if(client && client.eye == eyeobj) // We are viewing the world through our "eye" mob. + src.sight |= SEE_TURFS + src.sight |= SEE_MOBS + src.sight |= SEE_OBJS + src.see_in_dark = 8 + src.see_invisible = SEE_INVISIBLE_LEVEL_TWO var/area/home = get_area(src) if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn