<commit_before>/obj/machinery/camera

	var/list/localMotionTargets = list()
	var/detectTime = 0
	var/area/ai_monitored/area_motion = null
	var/alarm_delay = 30 // Don't forget, there's another 3 seconds in queueAlarm()

/obj/machinery/camera/process()
	// motion camera event loop
	if(!isMotion())
		. = PROCESS_KILL
		return
	if (detectTime > 0)
		var/elapsed = world.time - detectTime
		if (elapsed > alarm_delay)
			triggerAlarm()
	else if (detectTime == -1)
		for (var/mob/target in getTargetList())
			if (target.stat == DEAD || (!area_motion && !in_range(src, target)))
				//If not part of a monitored area and the camera is not in range or the target is dead
				lostTarget(target)

/obj/machinery/camera/proc/getTargetList()
	if(area_motion)
		return area_motion.motionTargets
	return localMotionTargets

/obj/machinery/camera/proc/newTarget(mob/target)
	if(isAI(target))
		return 0
	if (detectTime == 0)
		detectTime = world.time // start the clock
	var/list/targets = getTargetList()
	if (!(target in targets))
		targets += target
	return 1

/obj/machinery/camera/Destroy()
	var/area/ai_monitored/A = get_area(src)
	if(istype(A))
		A.motioncameras -= src
	return ..()

/obj/machinery/camera/proc/lostTarget(mob/target)
	var/list/targets = getTargetList()
	if (target in targets)
		targets -= target
	if (targets.len == 0)
		cancelAlarm()

/obj/machinery/camera/proc/cancelAlarm()
	if (detectTime == -1)
		for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
			if (status)
				aiPlayer.cancelAlarm("Motion", get_area(src), src)
	detectTime = 0
	return 1

/obj/machinery/camera/proc/triggerAlarm()
	if (!detectTime)
		return 0
	for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
		if (status)
			aiPlayer.triggerAlarm("Motion", get_area(src), list(src), src)
	detectTime = -1
	return 1

/obj/machinery/camera/HasProximity(atom/movable/AM as mob|obj)
	// Motion cameras outside of an "ai monitored" area will use this to detect stuff.
	if (!area_motion)
		if(isliving(AM))
			newTarget(AM)<commit_msg>Removes mob references from camera motion tracking<commit_after><<<<<<< HEAD
/obj/machinery/camera

	var/list/localMotionTargets = list()
	var/detectTime = 0
	var/area/ai_monitored/area_motion = null
	var/alarm_delay = 30 // Don't forget, there's another 3 seconds in queueAlarm()

/obj/machinery/camera/process()
	// motion camera event loop
	if(!isMotion())
		. = PROCESS_KILL
		return
	if (detectTime > 0)
		var/elapsed = world.time - detectTime
		if (elapsed > alarm_delay)
			triggerAlarm()
	else if (detectTime == -1)
		for (var/mob/target in getTargetList())
			if (target.stat == DEAD || (!area_motion && !in_range(src, target)))
				//If not part of a monitored area and the camera is not in range or the target is dead
				lostTarget(target)

/obj/machinery/camera/proc/getTargetList()
	if(area_motion)
		return area_motion.motionTargets
	return localMotionTargets

/obj/machinery/camera/proc/newTarget(mob/target)
	if(isAI(target))
		return 0
	if (detectTime == 0)
		detectTime = world.time // start the clock
	var/list/targets = getTargetList()
	if (!(target in targets))
		targets += target
	return 1

/obj/machinery/camera/Destroy()
	var/area/ai_monitored/A = get_area(src)
	if(istype(A))
		A.motioncameras -= src
	return ..()

/obj/machinery/camera/proc/lostTarget(mob/target)
	var/list/targets = getTargetList()
	if (target in targets)
		targets -= target
	if (targets.len == 0)
		cancelAlarm()

/obj/machinery/camera/proc/cancelAlarm()
	if (detectTime == -1)
		for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
			if (status)
				aiPlayer.cancelAlarm("Motion", get_area(src), src)
	detectTime = 0
	return 1

/obj/machinery/camera/proc/triggerAlarm()
	if (!detectTime)
		return 0
	for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
		if (status)
			aiPlayer.triggerAlarm("Motion", get_area(src), list(src), src)
	detectTime = -1
	return 1

/obj/machinery/camera/HasProximity(atom/movable/AM as mob|obj)
	// Motion cameras outside of an "ai monitored" area will use this to detect stuff.
	if (!area_motion)
		if(isliving(AM))
			newTarget(AM)
=======
/obj/machinery/camera

	var/list/localMotionTargets = list()
	var/detectTime = 0
	var/area/ai_monitored/area_motion = null
	var/alarm_delay = 30 // Don't forget, there's another 3 seconds in queueAlarm()

/obj/machinery/camera/process()
	// motion camera event loop
	if(!isMotion())
		. = PROCESS_KILL
		return
	if (detectTime > 0)
		var/elapsed = world.time - detectTime
		if (elapsed > alarm_delay)
			triggerAlarm()
	else if (detectTime == -1)
		for (var/targetref in getTargetList())
			var/mob/target = locate(targetref) in GLOB.mob_list
			if (target.stat == DEAD || QDELETED(target) || (!area_motion && !in_range(src, target)))
				//If not part of a monitored area and the camera is not in range or the target is dead
				lostTarget(target)

/obj/machinery/camera/proc/getTargetList()
	if(area_motion)
		return area_motion.motionTargets
	return localMotionTargets

/obj/machinery/camera/proc/newTarget(mob/target)
	if(isAI(target))
		return 0
	if (detectTime == 0)
		detectTime = world.time // start the clock
	var/list/targets = getTargetList()
	targets |= "\ref[target]"
	return 1

/obj/machinery/camera/Destroy()
	var/area/ai_monitored/A = get_area(src)
	if(istype(A))
		A.motioncameras -= src
	return ..()

/obj/machinery/camera/proc/lostTarget(mob/target)
	var/list/targets = getTargetList()
	targets -= "\ref[target]"
	if (targets.len == 0)
		cancelAlarm()

/obj/machinery/camera/proc/cancelAlarm()
	if (detectTime == -1)
		for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
			if (status)
				aiPlayer.cancelAlarm("Motion", get_area(src), src)
	detectTime = 0
	return 1

/obj/machinery/camera/proc/triggerAlarm()
	if (!detectTime)
		return 0
	for (var/mob/living/silicon/aiPlayer in GLOB.player_list)
		if (status)
			aiPlayer.triggerAlarm("Motion", get_area(src), list(src), src)
	detectTime = -1
	return 1

/obj/machinery/camera/HasProximity(atom/movable/AM as mob|obj)
	// Motion cameras outside of an "ai monitored" area will use this to detect stuff.
	if (!area_motion)
		if(isliving(AM))
			newTarget(AM)

>>>>>>> 1dc0519... Removes mob references from camera motion tracking (#32002)
{'fraction_non_alphanumeric': 0.13129525341914722, 'fraction_numerical': 0.009332260659694287, 'mean_word_length': 4.053658536585366, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4994336', 'n_tokens_mistral': 2467, 'n_tokens_neox': 2221, 'n_words': 535}