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

'start out happy with where we are
If s.controller.goalx = 0 Then s.controller.goalx = s.x
If s.controller.goaly = 0 Then s.controller.goaly = s.y

'should we explode?
Local explode = False

'go towards the target
If target <> Null
	'set the goal coords to the target
	AI.setGoalTo(s, "target")
	
	'set the go coords to the goal
	s.controller.gox = s.controller.goalx - s.x
	s.controller.goy = s.controller.goaly - s.y
	
	'face the target
	AI.face(s, "go")
	AI.go(s)
	
	'explode if get close enough to target
	If approxDist(s.controller.gox, s.controller.goy) <= 10 Then explode = True
Else
	'get a target
	If s.controller.vars.get("seeker") = 1
		s.controller.vars.set("firstgettarget", 1)
		AI.getTarget(s, 700, 400)
	Else
		'explodes on no target
		explode = True
	EndIf
EndIf

'explodes on sufficient damage
If (s.armour / s.stat.armour) <= .5 Then explode = True

'explodes if fuse ticks down
If s.controller.hasTimerTicked("fuse") Then explode = True

'BOOM???
If explode
	AI.fireAIWeapons(s, 0)
	AI.fireAIWeapons(s, 1)
	s.armour = 0
EndIf
