@name Radar
@inputs On
@outputs
@persist Detected:array Bearing:array Scan
@trigger

if(first()|duped()){
	RunOnTick(1)
	E=entity()
	Range=1000
	Scale=5 #this means 1000 units become 50 on the radar
	Angle=-180 #the start angle of the scan line
}

if(Scan){
	EPos=entity():pos()
	findInSphere(entity(),Range) 
	Detected = findToArray()
	for(I=1,Detected:count){
		Bearing[I,normal]=round(E:bearing(Detected[I,entiy]:pos()))
		Distance[I,normal]=(Detected[I,entiy]:pos()-EPos):length()
	}
	Scan=0
}
if(On){
	for(I=1,Bearing:count){
		If(Bearing[I,normal]==Angle){
			Flash=1
			Dist=Distance[I,normal]
			}
	}
	#a holo that rotates with the angle variable goes here also make it light a point when Flash==1 at Dist
	Bearing++
	if(Bearing>180){
		Bearing=-180
		Scan=1
	}
}
