'== included in the AI scripts file =='
If s.spin = 0 Then s.spin = binsgn(Rand(0,1)) * 3

'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

'try to avoid collisions: sets gox & goy to point away from nearby ss
AI.setProximityAvoid(s)

'choose an angle to attack from
vars.init("offsetx", Rand(100,250)*binsgn(Rand(0,1)))
vars.init("offsety", Rand(100,250)*binsgn(Rand(0,1)))

'set the goal coords to the target (to circle them) (ability takes care of the shooting)
If target <> Null
	AI.setGoalTo(s, "target")
	s.controller.goalx:+ vars.get("offsetx")
	s.controller.goaly:+ vars.get("offsety")
	'fireweapons at given position
	AI.fireAIWeapons(s, 0, s.x - vars.get("offsetx"), s.y - vars.get("offsety"))
EndIf

'circle / aim towards the target space
vars.init("holdrad", 20)
AI.holdingPattern(s)

'go in the decided direction
AI.go(s)

'look for a s.target
AI.getTarget(s, 3000)

'if we die, activate pulsar
If s.armour <= 0 Or s.dead
	s.activateAbility()
	new_text("EMP!", s.x, s.y, 1800)
EndIf

