anchor.diff:  
   	var/shot_sound 			//what sound should play when the turret fires
   	var/eshot_sound			//what sound should play when the emagged turret fires
  +
  +	var/faction = "neutral"
   
   	var/datum/effect/effect/system/spark_spread/spark_system	//the spark system, used for generating... sparks?
   
  
positive.code: 		return 1
  	return
  
  /obj/machinery/porta_turret/proc/shootAt(var/mob/living/target)
  	if(!emagged)	//if it hasn't been emagged, it has to obey a cooldown rate
  		if(last_fired || !raised)	//prevents rapid-fire shooting, unless it's been emagged
  			return
  
negative.code: 		return
  
  	var/list/targets = list()			//list of primary targets
  	var/turretview = view(7, src)
  
  	if(check_anomalies)	//if it's set to check for xenos/simpleanimals
  		for(var/mob/living/simple_animal/SA in turretview)
  			if(!SA.stat && (!SA.has_unlimited_silicon_privilege || !(faction in SA.faction)) ) //don't target dead animals or NT maint drones.
  				targets += SA
  
  	for(var/mob/living/carbon/C in turretview)	//loops through all carbon-based lifeforms in view(7)
  		if(emagged && C.stat != DEAD)	//if emagged, every living carbon is a target.
  			targets += C
  			continue
  
  		if(C.stat || C.handcuffed || C.lying)	//if the perp is handcuffed or lying or dead/dying, no need to bother really
  			continue
  
  		if(ai)	//If it's set to attack all nonsilicons, target them!
  			targets += C
  			continue
  
  		if(istype(C, /mob/living/carbon/human))	//if the target is a human, analyze threat level
  			if(assess_perp(C) >= 4)
  				targets += C
  
  		else if(check_anomalies)
  			if(!(faction in C.faction))
  				for(var/F in C.faction) //We target carbons without the portaturret's faction and who also have alien or slime faction.
  					if(F == "alien" || F == "slime")
  						targets += C
  						break
  
  	for(var/obj/mecha/M in turretview)
  		if(M.occupant)
  			if(ai || emagged) // we target all occupied mechs if we're emagged or set to attack all non silicons.
  				targets += M
  
  	if(!tryToShootAt(targets))
  		spawn()
  			popDown() // no valid targets, close the cover
  
  
  /obj/machinery/porta_turret/proc/tryToShootAt(var/list/atom/movable/targets)
  	while(targets.len > 0)
  		var/atom/movable/M = pick(targets)
  		targets -= M
  		if(target(M))
  			return 1
  