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

'face(s, "goal")			'face the target

If s.controller.vars.get("init") = 0 And Not s.base.bio
	Local e:Emitter = new_emitter("missiletrail")
	e.attach(s)
	e.upload()
	s.controller.vars.set("init", 1)
	
	'add a caution effect
	s.controller.vars.init("caution", 1)
EndIf



s.add_thrust(0, 1, False)	'go straight forward

'explodes on sufficient damage or reached target or fuse goes off
Local splode = False
If (s.armour / s.stat.armour) <= .5 Then splode = True
If approxDist(s.x - s.controller.goalx, s.y - s.controller.goaly) <= 20 Then splode = True
If s.controller.hasTimerTicked("fuse") Then splode = True
If Abs(s.x) > stage.width Or Abs(s.y) > stage.height Then splode = True

If splode
	AI.fireAIWeapons(s, 0)
	AI.fireAIWeapons(s, 1)
	's.activateAbility()
	s.armour = 0
EndIf
