/obj/machinery/camera name = "security camera" desc = "A small, high quality camera with thermal, light-amplification, and diffused laser imaging to see through walls. It is tied into a computer system, allowing those with access to watch what occurs around it." icon = 'icons/obj/monitors.dmi' icon_state = "camera" var/network = "SS13" layer = EFFECTS_LAYER_UNDER_1 var/c_tag = null var/c_tag_order = 999 var/status = 1.0 anchored = 1.0 var/invuln = null var/last_paper = 0 //This camera is a node pointing to the other bunch of cameras nearby for AI movement purposes var/obj/machinery/camera/c_north = null var/obj/machinery/camera/c_east = null var/obj/machinery/camera/c_west = null var/obj/machinery/camera/c_south = null //Here's a list of cameras pointing to this camera for reprocessing purposes var/list/obj/machinery/camera/referrers = list() /obj/machinery/camera/television name = "television camera" desc = "A bulky stationary camera for wireless broadcasting of live feeds." network = "Zeta" // why not. icon_state = "television" anchored = 1 density = 1 /obj/machinery/camera/television/mobile name = "mobile television camera" desc = "A bulky mobile camera for wireless broadcasting of live feeds." anchored = 0 icon_state = "mobilevision" /obj/machinery/camera/New() ..() cameras.Add(src) spawn(10) // making life easy for mappers since 2013 if (dd_hasprefix(name, "autoname")) var/area/where = get_area(src) if (isarea(where)) name = "security camera" var/count = 1 for(var/obj/machinery/camera/C in where) if (C == src) continue if (dd_hasprefix(C.name, "autoname")) C.name = "security camera" if (C.c_tag == "autotag") count++ C.c_tag = "[where.name] [count]" if (c_tag == "autotag") if (count > 1) c_tag = "[where.name] 1" else c_tag = "[where.name]" addToNetwork() /obj/machinery/camera/proc/addToNetwork() if(camnets[network]) var/list/net = camnets[network] net.Add(src) else var/list/net = list() net.Add(src) camnets[network] = net /obj/machinery/camera/proc/addToReferrers(var/obj/machinery/camera/C) //Safe addition if(!(C in referrers)) referrers += C /obj/machinery/camera/proc/removeNode(var/obj/machinery/camera/node) //Completely remove a node from this camera for(var/N in list("c_north", "c_east", "c_south", "c_west")) if(node == vars[N]) vars[N] = null node.referrers -= src /obj/machinery/camera/proc/hasNode(var/obj/machinery/camera/node) if(!istype(node)) return 0 . = 0 . = (node == c_north) + (node == c_east) + (node == c_south) + (node == c_west) /obj/machinery/camera/disposing() ..() dirty_cameras |= referrers camnet_needs_rebuild = 1 for(var/obj/machinery/camera/C in referrers) //In case the GC does not have time to remove us from the referring cameras C.removeNode(src) //logTheThing("debug", null, null, "SpyGuy/Camnet: Camera destroyed. Camera network needs a rebuild! Number of dirty cameras: [dirty_cameras.len]") //connect_camera_list(referrers) /obj/machinery/camera/ex_act(severity) if(src.invuln) return else ..(severity) return /obj/machinery/camera/emp_act() ..() src.icon_state = "cameraemp" src.network = null //Not the best way but it will do. I think. spawn(900) src.network = initial(src.network) src.icon_state = initial(src.icon_state) src.disconnect_viewers() return /obj/machinery/camera/blob_act(var/power) return /obj/machinery/camera/attack_ai(var/mob/living/silicon/ai/user as mob) if (!istype(user)) //Other silicon mobs shouldn't try to encroach on the AI's "view through all cameras" schtick. Mostly because it generates runtime errors. return if (src.network != user.network || !(src.status)) return //if (istype(user, /mob/living/silicon/ai/hologram)) // return user.current = src user.set_eye(src) // v the fuck is this??? v /*/obj/machinery/camera/attack_hand(mob/user as mob) if(user.jew == 1) src.status = !( src.status ) if (!( src.status )) var/message = pick("OY VEY!","Bupkes!","Feh!","What a mishegas!","Schlocky putz!") user.say(message) src.icon_state = "camera1" else var/message = pick("OY VEY!","Bupkes!","Feh!","What a mishegas!","Schlocky putz!") user.say(message) src.icon_state = "camera" // now disconnect anyone using the camera disconnect_viewers() else return return*/ /obj/machinery/camera/proc/disconnect_viewers() for(var/mob/O in mobs) if (istype(O, /mob/living/silicon/ai)) var/mob/living/silicon/ai/OAI = O if (OAI.current == src) if( OAI.camera_overlay_check(src) ) boutput(OAI, "Your regain your connection to the camera.") else boutput(OAI, "Your connection to the camera has been lost.") else if (istype(O.machine, /obj/machinery/computer/security)) var/obj/machinery/computer/security/S = O.machine if (S.current == src) O.machine = null S.current = null O.set_eye(null) boutput(O, "The screen bursts into static.") /obj/machinery/camera/attackby(obj/W as obj, mob/user as mob) if(istype(W,/obj/item/parts/human_parts)) //dumb easter egg incoming user.visible_message("[user] wipes [src] with the bloody end of [W.name]. What the fuck?", "You wipe [src] with the bloody end of [W.name]. What the fuck?") return if (istype(W, /obj/item/wirecutters)) src.status = !( src.status ) if (!( src.status )) user.visible_message("[user] has deactivated [src]!", "You have deactivated [src].") logTheThing("station", null, null, "[key_name(user)] deactivated a security camera ([showCoords(src.loc.x, src.loc.y, src.loc.z)])") playsound(src.loc, "sound/items/Wirecutter.ogg", 100, 1) src.icon_state = "camera1" add_fingerprint(user) else user.visible_message("[user] has reactivated [src]!", "You have reactivated [src].") playsound(src.loc, "sound/items/Wirecutter.ogg", 100, 1) src.icon_state = "camera" add_fingerprint(user) // now disconnect anyone using the camera src.disconnect_viewers() else if (istype(W, /obj/item/paper)) if (last_paper && ( (last_paper + 80) >= world.time)) return last_paper = world.time var/obj/item/paper/X = W boutput(user, "You hold a paper up to the camera ...") for(var/mob/O in mobs) if (istype(O, /mob/living/silicon/ai)) boutput(O, "[user] holds a paper up to one of your cameras ...") O << browse(text("