//=============================================================================
// StingerProjectile.
//=============================================================================
class StingerProjectile expands Projectile;

#exec MESH IMPORT MESH=TarydiumProjectile ANIVFILE=MODELS\aniv52.3D DATAFILE=MODELS\data52.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=TarydiumProjectile X=0 Y=0 Z=0 YAW=64
#exec MESH SEQUENCE MESH=TarydiumProjectile SEQ=All  STARTFRAME=0  NUMFRAMES=1
#exec TEXTURE IMPORT NAME=Tarydium1 FILE=MODELS\shells.PCX 
#exec MESHMAP SCALE MESHMAP=TarydiumProjectile X=0.015 Y=0.015 Z=0.03
#exec MESHMAP SETTEXTURE MESHMAP=TarydiumProjectile NUM=4 TEXTURE=Tarydium1

#exec AUDIO IMPORT FILE="Sounds\stinger\Ricochet.WAV" NAME="Ricochet" GROUP="Stinger"
#exec AUDIO IMPORT FILE="Sounds\Razor\bladehit.wav" NAME="BladeHit" GROUP="RazorJack"

var bool bLighting;
var float DelayTime;

/////////////////////////////////////////////////////
auto state Flying
{
	function ProcessTouch( Actor Other, Vector HitLocation )
	{
		local int hitdamage;
		local vector hitDir;
		
		if (Other != instigator && StingerProjectile(Other) == none)
		{
			hitDir = Normal(Velocity);
			Other.Damage(damage, instigator,HitLocation,
				(MomentumTransfer * hitDir), 'shot');			
		}
	}
	simulated function HitWall( vector HitNormal, actor Wall )
	{
		CallParent.HitWall(HitNormal, Wall);	
		if (FRand()<0.3) PlaySound(ImpactSound, SLOT_Misc, 0.5,,, 0.5+FRand());
		else  PlaySound(MiscSound, SLOT_Misc, 0.6,,,1.0);
	}
	simulated function Timer()
	{
		local bubble b;
		if (Level.NetMode!=NM_Server)
		{
	 		b=spawn(class'Bubble1'); 	
 			b.DrawScale= 0.1 + FRand()*0.2;
 			b.SetLocation(Location+FRand()*vect(2,0,0)+FRand()*Vect(0,2,0)+FRand()*Vect(0,0,2));
 			b.buoyancy = b.mass+(FRand()*0.4+0.1);
 		}
		DelayTime+=FRand()*0.1+0.1;
		SetTimer(DelayTime,False); 	
	}
	function ZoneChange( Zoneinfo NewZone )
	{
		if (NewZone.bWaterZone) 
		{
			Velocity=0.7*Velocity;	
			DelayTime=0.03;		
			SetTimer(DelayTime,False);
		}
	}

	function BeginState()
	{
		local rotation RandRot;

		Velocity = Vector(Rotation) * speed;
		RandRot.Pitch = FRand() * 200 - 100;
		RandRot.Yaw = FRand() * 200 - 100;
		RandRot.Roll = FRand() * 200 - 100;
		Velocity = Velocity >> RandRot;
		if( Region.zone.bWaterZone )
			Velocity=0.7*Velocity;
	}
}

///////////////////////////////////////////////////////
function Explode(vector HitLocation, vector HitNormal)
{
	MakeNoise(0.3);
  	Spawn(Class'Burst');		
  	Destroy();
}

