N@turret Aimer
I@Xa Ya Za  Active
O@Mul Fyaw Froll Fpitch Fire Latch Pitchdif Yawdif
T=0.03*Active
interval(T*1000)

Active!=1->Latch=1 Fyaw=0 Fpitch=0 Froll=0 Mul=0;
Active==1->
	Latch=0

	clk()->

		Target=vector(Xa, Ya, Za)
		Self=extpos()
		Dist=vecsub(Target, Self)

		Yaw=vecyaw(Dist)
		Pitch=vecpitch(Dist)

		Yawdif=angnorm(extangy()-Yaw)
		Pitchdif=angnorm(extangp()-Pitch)
		Rolldif=extangr()

		YawVF=Yawdif/3/T
		PitchVF=Pitchdif/3/T
		RollVF=Rolldif/3/T

		Fyaw=(360.56*200+4*200*576)/T/50/24*rad(YawVF*cos(extangp())+extangvelr())

		Fpitch=(181.07*200+2*200*576)/T/183.6375/24*rad(PitchVF+extangvely()) 

		Froll=-(181.07*200+2*200*576)/T/50/24*rad(RollVF-YawVF*sin(extangp())+extangvelp())


		Mul=sqrt(Froll^2+Fyaw^2)
	;
;
