
class CSSShellsShotgun extends BaseShellCase;

#exec MESH IMPORT MESH=ShotShellHP ANIVFILE=MODELS\ShotShellHP_a.3d DATAFILE=MODELS\ShotShellHP_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=ShotShellHP X=0 Y=0 Z=0

#exec MESH SEQUENCE MESH=ShotShellHP SEQ=All STARTFRAME=0 NUMFRAMES=1

#exec MESHMAP NEW MESHMAP=ShotShellHP MESH=ShotShellHP
#exec MESHMAP SCALE MESHMAP=ShotShellHP X=0.1 Y=0.1 Z=0.2

#exec TEXTURE IMPORT NAME=shotshellskin FILE=Textures\shotshellskin.bmp GROUP=Skins LODSET=2
#exec MESHMAP SETTEXTURE MESHMAP=ShotShellHP NUM=0 TEXTURE=shotshellskin

#exec AUDIO IMPORT NAME="SGBounce1" FILE=Sounds\EjectingShells\Shotguns\sshell1.wav GROUP="EjectingShells"
#exec AUDIO IMPORT NAME="SGBounce2" FILE=Sounds\EjectingShells\Shotguns\sshell2.wav GROUP="EjectingShells"
#exec AUDIO IMPORT NAME="SGBounce3" FILE=Sounds\EjectingShells\Shotguns\sshell3.wav GROUP="EjectingShells"

var sound Bounces[3];

simulated function HitWall(vector HitNormal, actor Wall)
{
	local vector RealHitNormal;

	if (Level.bDropDetail)
	{
		Destroy();
		return;
	}
	if (bHasBounced && ((numBounces > 3) || (FRand() < 0.85) || (Velocity.Z > -50)))
		bBounce = false;
	numBounces++;
	if (numBounces > 3)
	{
		Destroy();
		return;
	}
	else if (!Region.Zone.bWaterZone)
		PlaySound(Bounces[Rand(3)]);
	RealHitNormal = HitNormal;
	HitNormal = Normal(HitNormal + 0.4 * VRand());
	if ((HitNormal Dot RealHitNormal) < 0)
		HitNormal *= -0.5; 
	Velocity = 0.5 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
	RandSpin(100000);
	bHasBounced = True;
}

simulated function Landed(vector HitNormal)
{
	local rotator RandRot;

	if (Level.bDropDetail)
	{
		Destroy();
		return;
	}
	if (!Region.Zone.bWaterZone)
		PlaySound(Bounces[Rand(3)]);
	if (numBounces > 3)
	{
		Destroy();
		return;
	}
	
	SetPhysics(PHYS_None);
	RandRot = Rotation;
	RandRot.Pitch = 0;
	RandRot.Roll = 0;
	SetRotation(RandRot);
}

defaultproperties
{
	Texture=texture'shotshellskin'
	Bounces(0)=Sound'BRUT.EjectingShells.SGBounce1'
	Bounces(1)=Sound'BRUT.EjectingShells.SGBounce2'
	Bounces(2)=Sound'BRUT.EjectingShells.SGBounce3'
   MaxSpeed=1000.000000
   bNetOptional=True
   bReplicateInstigator=False
   Physics=PHYS_Falling
   RemoteRole=ROLE_SimulatedProxy
   LifeSpan=3.000000
   Mesh=LodMesh'ShotShellHP'
   bUnlit=False
   AmbientGlow=64
   bCollideActors=False
   bBounce=True
   bFixedRotationDir=True
   NetPriority=1.400000
}
