/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" deconstruct_flags = DECON_SCREWDRIVER | DECON_WELDER | DECON_WIRECUTTERS | DECON_MULTITOOL var/network = "SS13" layer = EFFECTS_LAYER_UNDER_1 var/c_tag = null var/c_tag_order = 999 var/camera_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() //MBC : Ok so this is a kind of dumb optimization thing. We want to unsubscribe cameras from the machine loop that do not need to process (All wall-mounted stuffs) // But sometimes a camera is created and then placed inside an object after a certain amount of ticks!! // We are gonna give cameras a grace period of a few process cycles before they decide they aren't needed. This is PROBABLY FINE! var/unsubscribe_grace_counter = 0 var/oldx = 0 var/oldy = 0 /obj/machinery/camera/process() .=..() if(!isturf(src.loc)) //This will end up removing coverage if camera is inside a thing. var/turf/T = get_turf(src) if(T && (T.x != oldx || T.y != oldy)) //This will end up removing coverage if camera is inside a thing. src.updateCoverage() //MBC : handles moving cameras! oldx = T.x oldy = T.y //boutput(world,"hewwo there : ) ") src.updateCoverage() //MBC : handles moving cameras! else if (src.type == /obj/machinery/camera) //we actually don't want this check to affect children, so we compare to exact type unsubscribe_grace_counter++ if (unsubscribe_grace_counter >= 5) UnsubscribeProcess() unsubscribe_grace_counter = -1 /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 var/securedstate = 2 /obj/machinery/camera/television/attackby(obj/item/W as obj, mob/user as mob) ..() if (isscrewingtool(W)) //to move them if (securedstate && src.securedstate >= 1) playsound(src.loc, "sound/items/Screwdriver.ogg", 30, 1, -2) actions.start(new/datum/action/bar/icon/cameraSecure(src, securedstate), user) else if (securedstate) boutput(user, "You need to secure the floor bolts!") else if (iswrenchingtool(W)) if (src.securedstate <= 1) playsound(src.loc, "sound/items/Wrench.ogg", 30, 1, -2) boutput(user, "You [securedstate == 1 ? "un" : ""]secure the floor bolts on the [src].") src.securedstate = (securedstate == 1) ? 0 : 1 if (securedstate == 0) src.anchored = 0 else src.anchored = 1 /datum/action/bar/icon/cameraSecure //This is used when you are securing a non-mobile television camera duration = 150 interrupt_flags = INTERRUPT_MOVE | INTERRUPT_ACT | INTERRUPT_STUNNED | INTERRUPT_ACTION id = "cameraSecure" icon = 'icons/obj/items.dmi' icon_state = "screwdriver" var/obj/machinery/camera/television/cam var/secstate New(Camera, Secstate) cam = Camera secstate = Secstate ..() onStart() ..() for(var/mob/O in AIviewers(owner)) O.show_message(text("[] begins [secstate == 2 ? "un" : ""]securing the camera hookups on the [cam].", owner), 1) onInterrupt(var/flag) ..() boutput(owner, "You were interrupted!") onEnd() ..() owner.visible_message("[owner.name] [secstate == 2 ? "un" : ""]secures the camera hookups on the [cam].") cam.securedstate = (secstate == 2) ? 1 : 2 if (cam.securedstate != 2) machines.Remove(cam) else machines.Add(cam) /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" securedstate = null //No bugginess thank you /obj/machinery/camera/New() ..() cameras.Add(src) SPAWN_DBG(1 SECOND) // 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() updateCoverage() //Make sure coverage is updated. (must happen in spawn!) add_to_turfs() /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() if (coveredTiles) //ZeWaka: Fix for null.Copy() for(var/turf/O in coveredTiles.Copy()) //Remove all coverage O.removeCameraCoverage(src) src.remove_from_turfs() //needs to happen BEFORE the actual deletion or else it fuckks up if(camnets && camnets[network]) camnets[network].Remove(src) cameras.Remove(src) if (c_north) c_north.referrers -= src if (c_east) c_east.referrers -= src if (c_south) c_south.referrers -= src if (c_west) c_west.referrers -= src for(var/obj/machinery/camera/C in referrers) if (C.c_north == src) C.c_north = null if (C.c_east == src) C.c_east = null if (C.c_south == src) C.c_south = null if (C.c_west == src) C.c_west = null //C.removeNode(src) src.referrers = null ..() dirty_cameras |= referrers camnet_needs_rebuild = 1 //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() ..() if(!istype(src, /obj/machinery/camera/television)) //tv cams were getting messed up src.icon_state = "cameraemp" src.network = null //Not the best way but it will do. I think. camera_status-- if (coveredTiles) //ZeWaka: Fix for null.Copy() for(var/turf/O in coveredTiles.Copy()) //Remove all coverage O.removeCameraCoverage(src) src.remove_from_turfs() SPAWN_DBG(90 SECONDS) camera_status++ src.network = initial(src.network) if(!istype(src, /obj/machinery/camera/television)) src.icon_state = initial(src.icon_state) src.add_to_turfs() if (coveredTiles) for(var/turf/O in coveredTiles.Copy()) O.addCameraCoverage(src) updateCoverage() // (must happen in spawn!) 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.camera_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.camera_status = !( src.camera_status ) if (!( src.camera_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) /* Not needed with new AI cam system if (isAI(O)) var/mob/living/silicon/ai/OAI = O if (OAI && 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.") */ 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/item/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 (issnippingtool(W)) src.camera_status = !( src.camera_status ) if (!( src.camera_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) if (coveredTiles) //ZeWaka: Fix for null.Copy() for(var/turf/O in coveredTiles.Copy()) //Remove all coverage O.removeCameraCoverage(src) src.remove_from_turfs() 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) src.add_to_turfs() if (coveredTiles) for(var/turf/O in coveredTiles.Copy()) O.addCameraCoverage(src) spawn() updateCoverage() //(must happen in spawn!) // 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 (isAI(O)) boutput(O, "[user] holds a paper up to one of your cameras ...") O.Browse(text("