//=============================================================================
// rocket.
//=============================================================================
class rocket expands Projectile;

#exec MESH IMPORT MESH=Rocket ANIVFILE=MODELS\rocket_a.3D DATAFILE=MODELS\rocket_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=Rocket X=0 Y=-240 Z=0 YAW=-64

#exec MESH SEQUENCE MESH=Rocket SEQ=All       STARTFRAME=0   NUMFRAMES=6
#exec MESH SEQUENCE MESH=Rocket SEQ=Still     STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=Rocket SEQ=WingIn    STARTFRAME=1   NUMFRAMES=1
#exec MESH SEQUENCE MESH=Rocket SEQ=Armed     STARTFRAME=1   NUMFRAMES=3
#exec MESH SEQUENCE MESH=Rocket SEQ=SpinCCW   STARTFRAME=4   NUMFRAMES=1
#exec MESH SEQUENCE MESH=Rocket SEQ=SpinCW    STARTFRAME=5   NUMFRAMES=1

#exec TEXTURE IMPORT NAME=JRocket1 FILE=MODELS\rocket.PCX
#exec OBJ LOAD FILE=Textures\fireeffect16.utx PACKAGE=UNREALI
#exec MESHMAP SCALE MESHMAP=rocket X=0.5 Y=0.5 Z=1.0 YAW=128
#exec MESHMAP SETTEXTURE MESHMAP=rocket NUM=1 TEXTURE=Jrocket1

#exec AUDIO IMPORT FILE="Sounds\EightBal\Ignite.WAV" NAME="Ignite" GROUP="Eightball"
#exec AUDIO IMPORT FILE="Sounds\EightBal\grenflor.UFX" NAME="GrenadeFloor" GROUP="Eightball"

var Actor Seeking;
var float MagnitudeVel,Count;
var vector InitialDir;
var bool bRing;

simulated function Tick(float DeltaTime)
{
	Count += DeltaTime;
	if (Count>(Frand()*0.15+0.15) && Level.NetMode!=NM_Server) 
	{
		Spawn(class'BlackSmoke');		
		Count=0;
	}
}


auto state Flying
{
	function ProcessTouch (Actor Other, Vector HitLocation)
	{
		if ((Other != instigator) && (Rocket(Other) == none)) 
			Explode(HitLocation,Normal(HitLocation-Other.Location));
	}

	function Explode(vector HitLocation, vector HitNormal)
	{
		HurtRadius(Damage,200.0, 'exploded', MomentumTransfer, HitLocation );
 		spawn(class'SpriteBallExplosion',,,HitLocation + HitNormal*16);	
 		if (bRing) Spawn(class'RingExplosion3',,,HitLocation + HitNormal*16,Rotation(HitNormal));
 		Destroy();
	}

	function BeginState()
	{
		initialDir = vector(Rotation);	
		Velocity = speed*initialDir;
		Acceleration = initialDir*50;
		PlaySound(SpawnSound);
		PlayAnim( 'Armed', 0.2 );
	}
}

