//=============================================================================
// WarlordRocket.
//=============================================================================
class WarlordRocket expands Projectile;

#exec MESH IMPORT MESH=perock ANIVFILE=MODELS\perock_a.3D DATAFILE=MODELS\perock_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=perock X=0 Y=0 Z=0 YAW=0 ROLL=0 PITCH=-64
#exec MESH SEQUENCE MESH=perock SEQ=All       STARTFRAME=0   NUMFRAMES=16
#exec MESH SEQUENCE MESH=perock SEQ=Ignite    STARTFRAME=0   NUMFRAMES=3
#exec MESH SEQUENCE MESH=perock SEQ=Flying    STARTFRAME=3   NUMFRAMES=13
#exec TEXTURE IMPORT NAME=Jpeace1 FILE=MODELS\peaceg.PCX
#exec MESHMAP SCALE MESHMAP=perock  X=0.07 Y=0.07 Z=0.14
#exec MESHMAP SETTEXTURE MESHMAP=perock NUM=1 TEXTURE=Jpeace1

var vector OriginalDirection;

function Explode(vector HitLocation, vector HitNormal)
{
	HurtRadius(damage, 200.0, 'exploded', MomentumTransfer, HitLocation);
	Spawn(class'SpriteBallExplosion', Pawn(Owner),,HitLocation);	
	Destroy();
}

auto state Flying
{
	function Timer()
	{
		local vector EnemyDir;

		if ( (Instigator != None) && (Instigator.Enemy != None) )
		{
			EnemyDir = Normal(Instigator.Enemy.Location - Location);
			if ( (EnemyDir Dot OriginalDirection) > 0 )
			{
				Velocity =  speed * Normal(EnemyDir * speed * (0.35 + instigator.skill * 0.05) + Velocity);		
				SetRotation(Rotation(Velocity));
			}
		}
	}

	function ProcessTouch (Actor Other, Vector HitLocation)
	{
		if ((PeaceRocket(Other) == none) && (Other != Instigator) ) 
			Explode(HitLocation, vect(0,0,0));
	}


	function BeginState()
	{
		PlaySound(SpawnSound);
		OriginalDirection = Vector(Rotation);	
		Velocity = OriginalDirection * 500.0;
		Acceleration = Velocity * 0.4;	
		SetTimer(0.1,True);
	}

Begin:
	Sleep(7.0);
	Explode(Location, vect(0,0,0));
}

