diff --git a/code/defines/mob/living/silicon/ai.dm b/code/defines/mob/living/silicon/ai.dm index ac4ec225500..0f519472ddd 100644 --- a/code/defines/mob/living/silicon/ai.dm +++ b/code/defines/mob/living/silicon/ai.dm @@ -29,4 +29,6 @@ var/obj/machinery/power/apc/malfhack = null var/explosive = 0 //does the AI explode when it dies? - var/mob/living/silicon/ai/parent = null \ No newline at end of file + var/mob/living/silicon/ai/parent = null + + var/camera_light_on = 0 //Defines if the AI toggled the light on the camera it's looking through. \ No newline at end of file diff --git a/code/game/machinery/camera.dm b/code/game/machinery/camera.dm index cec954a2d4a..9bfd1d91fcc 100644 --- a/code/game/machinery/camera.dm +++ b/code/game/machinery/camera.dm @@ -141,7 +141,6 @@ var/global/list/obj/machinery/camera/Cameras = list() if(isrobot(target)) var/mob/living/silicon/robot/R = target C = R.camera - U.current = C U.reset_view(C) else var/closestDist = -1 @@ -165,7 +164,6 @@ var/global/list/obj/machinery/camera/Cameras = list() //U << text("Closest camera dist = [], for camera []", closestDist, closest.area.name) if (closest != C) - U.current = closest U.reset_view(closest) //use_power(50) if (zmatched == 0) @@ -204,7 +202,6 @@ var/global/list/obj/machinery/camera/Cameras = list() // If they cancel then just put them back to their old camera var/obj/machinery/camera/tempC = src.current user.machine = src - src.current = null switchCamera(null) var/list/L = list() @@ -223,10 +220,8 @@ var/global/list/obj/machinery/camera/Cameras = list() if (!t || t == "Cancel") if(tempC && tempC.status) - src.current = tempC - switchCamera(null) + switchCamera(tempC) else - src.current = null switchCamera(null) return 0 @@ -251,7 +246,6 @@ var/global/list/obj/machinery/camera/Cameras = list() var/obj/machinery/computer/security/S = O.machine if (S.current == src) O.machine = null - S.current = null O.reset_view(null) O << "The screen bursts into static." ..() @@ -274,7 +268,6 @@ var/global/list/obj/machinery/camera/Cameras = list() return if (src.network != user.network || !(src.status)) return - user.current = src user.reset_view(src) /obj/machinery/camera/attack_paw(mob/living/carbon/alien/humanoid/user as mob) @@ -397,7 +390,6 @@ var/global/list/obj/machinery/camera/Cameras = list() var/obj/machinery/computer/security/S = O.machine if (S.current == src) O.machine = null - S.current = null O.reset_view(null) O << "The screen bursts into static." diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index f5e22848686..64e6c2ac040 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1,3 +1,5 @@ +#define AI_CAMERA_LUMINOSITY 6 + /mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0) var/list/possibleNames = ai_names @@ -35,7 +37,8 @@ if (istype(loc, /turf)) verbs.Add(/mob/living/silicon/ai/proc/ai_call_shuttle,/mob/living/silicon/ai/proc/ai_camera_track, \ /mob/living/silicon/ai/proc/ai_camera_list, /mob/living/silicon/ai/proc/ai_network_change, \ - /mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change) + /mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \ + /mob/living/silicon/ai/proc/toggle_camera_light) if(!safety)//Only used by AIize() to successfully spawn an AI. if (!B)//If there is no player/brain inside. @@ -355,6 +358,14 @@ adjustBruteLoss(damage) updatehealth() +/mob/living/silicon/ai/reset_view(atom/A) + if(current) + current.sd_SetLuminosity(0) + if(istype(A,/obj/machinery/camera)) + current = A + ..() + if(istype(A,/obj/machinery/camera)) + A.sd_SetLuminosity(camera_light_on * AI_CAMERA_LUMINOSITY) /mob/living/silicon/ai/proc/switchCamera(var/obj/machinery/camera/C) @@ -367,7 +378,6 @@ // ok, we're alive, camera is good and in our network... machine = src - src.current = C reset_view(C) return 1 @@ -519,4 +529,19 @@ if(!istype(apc)) src << "\blue You are already in your Main Core." return - apc.malfvacate() \ No newline at end of file + apc.malfvacate() + +//Toggles the luminosity and applies it by re-entereing the camera. +/mob/living/silicon/ai/proc/toggle_camera_light() + set name = "Toggle camera light" + set desc = "Toggles the light on the camera the AI is looking through." + set category = "AI Commands" + + if(!current) + usr << "\red You are not looking through a camera right now." + return + camera_light_on = !camera_light_on + reset_view(current) + + +#undef AI_CAMERA_LUMINOSITY \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 58af6441b08..530fcfdd14a 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -6,9 +6,9 @@ var/turf/T = get_turf(src) if (src.stat!=0) - src:cameraFollow = null - src:current = null - src:machine = null + src.cameraFollow = null + src.reset_view(null) + src.machine = null src.updatehealth() diff --git a/code/modules/mob/living/silicon/ai/move.dm b/code/modules/mob/living/silicon/ai/move.dm index 9fb33a12d94..9417b640a31 100644 --- a/code/modules/mob/living/silicon/ai/move.dm +++ b/code/modules/mob/living/silicon/ai/move.dm @@ -81,4 +81,4 @@ if(!closest) return - user.switchCamera(closest) + user.switchCamera(closest) \ No newline at end of file