//=============================================================================
// KraalBolt.
//=============================================================================
class KraalBolt expands Projectile;

#exec AUDIO IMPORT FILE="Sounds\Krall\krasht2.wav" NAME="Krasht2" GROUP="Krall"

#exec MESH IMPORT MESH=plasma ANIVFILE=MODELS\cros_t_a.3D DATAFILE=MODELS\cros_t_d.3D X=0 Y=0 Z=0 
#exec MESH ORIGIN MESH=plasma X=0 Y=0 Z=0 YAW=-64
#exec MESH SEQUENCE MESH=plasma SEQ=All STARTFRAME=0  NUMFRAMES=1
#exec MESH SEQUENCE MESH=plasma SEQ=Still  STARTFRAME=0 NUMFRAMES=1
#exec MESHMAP SCALE MESHMAP=plasma X=0.04 Y=0.04 Z=0.08
#exec OBJ LOAD FILE=Textures\fireeffect1.utx PACKAGE=UNREALI
#exec MESHMAP SETTEXTURE MESHMAP=plasma NUM=0 TEXTURE=FireEffect1a
#exec MESHMAP SETTEXTURE MESHMAP=plasma NUM=1 TEXTURE=FireEffect1
  
function PreBeginPlay()
{
	if ( ScriptedPawn(Instigator) != None )
		Speed = ScriptedPawn(Instigator).ProjectileSpeed;
	CallParent.PreBeginPlay();
	PlaySound(SpawnSound,,4.0);
	Velocity = Vector(Rotation) * speed;
	PlayAnim('Fire',0.8);
} 

function Explode(vector HitLocation, vector HitNormal)
{
	PlaySound(ImpactSound);
 	spawn(class'SpriteSmokePuff');
	destroy();
}
	

auto state Flying
{
	function ProcessTouch (Actor Other, Vector HitLocation)
	{
		local vector momentum;
	
		if ( (Krall(Other) == None) && (KraalBolt(Other) == None))
		{
			momentum = MomentumTransfer * Normal(Velocity);
			Other.damage( Damage, instigator, HitLocation, momentum, 'zapped');
			Destroy();
		}
	}
	
Begin:
	Sleep(7.0); //self destruct after 7.0 seconds
	Explode(Location, vect(0,0,0));
}

