; Helo Mineweeping Sonar Doctrine For 1.1 -Reinforce Alert- DWX Addon 

var Range
var OpSpd
var OpSpd1
var OpSpd2
var PreenableCourse

IF INIT THEN {
	SetEntVar "TRAL" 1
	OpSpd1 = 10
	OpSpd2 = ( 45 + ( RND 20 ) )
} ENDIF

Range = TgtRNG
PreenableCourse = XYBRG ( tgtx - ownx ) ( tgty - owny )

IF ( ( Range < 25000 ) AND ( Range >= 500 ) ) THEN {
	IF ( abs ( OwnCrs - PreenableCourse ) > 10 ) Then { OpSpd = 15
} ELSE {
	OpSpd = OpSpd2
} Endif
	SETPRIORITY 252
	SETCRS PreenableCourse
	SETPRIORITY 252
	SETALT 100
	SETSPD OpSpd
} ELSEIF ( ( Range < 499 ) AND ( Range >= 0 ) ) THEN {
	SETPRIORITY 252
	SETCRS PreenableCourse
	SETSPD OpSpd1
	SETPRIORITY 252
	SETALT 45
	SensorEnable "Mineweep 1" 1
	SensorEnable "Mineweep 2" 1
	SensorEnable "Mineweep 3" 1
	SensorEnable "Mineweep 4" 1
;	DEBUGOUT "Mine Cut Phaze"
} ENDIF

If Losttrack Then { SetEntVar "TRAL" 0 SetEntVar "ObjectCount" 0 } Endif
