'== included in the AI scripts file =='

Rem
'has an offset firing pattern from other turrets
If s.controller.vars.get("scrambled") = 0
	s.controller.vars.set("scrambled", 1)
	For Local g:Gun = EachIn s.gunGroup[0]
		Local bump = Rand(0, timerMaxTime(g.timerList, "fireDelay"))
		timerBump(g.timerList, "fireDelay", bump)
	Next
EndIf
EndRem


'look for a target
AI.getTarget(s, 4000)
	
'slow down
If s.speed > 5 Then s.speed = s.speed - 5*timeMod Else s.speed = 0

'act as a turret
If target <> Null
	'face the target
	AI.setGoalTo(s, "target")
	AI.face(s, "goal")
	
	'if within range
	If approxDist(s.x-s.controller.goalx,s.y-s.controller.goaly) <= rangeGroup(s, 0) 
		'fireAIWeapons(s, 0, target.x,  target.y)		'fire at current target coords
		AI.fireAIWeapons(s, 0)								'fire at predicted target coords
	EndIf
EndIf

