// ------------------------------------------------------------------------
// grenade (thrown by hand) script
// ------------------------------------------------------------------------
datablock AudioProfile(GrenadeThrowSound)
{
	filename = "fx/weapons/throw_grenade.wav";
	description = AudioClose3D;
   preload = true;
};

datablock AudioProfile(GrenadeSwitchSound)
{
	filename = "fx/Bonuses/gadget3.wav";
	description = AudioClosest3D;
   preload = true;
};

//**************************************************************************
// Hand Grenade underwater fx
//**************************************************************************


//--------------------------------------------------------------------------
// Underwater Hand Grenade Particle effects
//--------------------------------------------------------------------------


//**************************************************************************
// Hand Grenade effects
//**************************************************************************

//--------------------------------------------------------------------------
// Grenade Particle effects
//--------------------------------------------------------------------------

datablock ParticleData(HandGrenadeExplosionSmoke)
{
   dragCoeffiecient     = 0.0;
   gravityCoefficient   = -0.0;   // rises slowly
   inheritedVelFactor   = 0.3;
   windCoefficient   = 0.0;
   constantAcceleration = -1.0;
   
   lifetimeMS           = 2000;
   lifetimeVarianceMS   = 1000;

  // textureName          = "particleTest";

   useInvAlpha =  $random10;
   spinRandomMin = -200.0;
   spinRandomMax =  200.0;

   textureName = "special/flare";

   colors[0]     = $color4 SPC $color2 SPC $color6 SPC "1.0";
   colors[1]     = $color5 SPC $color1 SPC $color3 SPC "0.5";
   colors[2]     = $color20 SPC $color10 SPC $color30 SPC "0.2";
   sizes[0]      = 1.7;
   sizes[1]      = 1;
   sizes[2]      = 0.3;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 2.0;

};

datablock ParticleEmitterData(HandGrenadeExplosionSmokeEmitter)
{
   ejectionPeriodMS = 11;
   periodVarianceMS = 0;

   ejectionVelocity = 60.25;
   velocityVariance = 20.25;
   phiReferenceVel  = 290;
   phiVariance      = 80;
   thetaMin         = 40.0;
   thetaMax         = 40.0;

   lifetimeMS       = "";

   particles = "HandGrenadeExplosionSmoke";
};



datablock ParticleData(HandGrenadeSparks)
{
   dragCoefficient      = 0;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.2;
   windCoefficient   = 0.0;
   constantAcceleration = -1.0;
   lifetimeMS           = 1800;
   lifetimeVarianceMS   = 350;
   spinRandomMin = -200.0;
   spinRandomMax =  200.0;
   textureName          = "skins/hvybioflare";
   colors[0]     = "1 1 1 1.0";
   colors[1]     = "1 1 1 0.5";
   colors[2]     = "1 1 1 0.1";
   sizes[0]      = 0.5;
   sizes[1]      = 0.25;
   sizes[2]      = 0.25;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;

};

datablock ParticleEmitterData(HandGrenadeSparkEmitter)
{
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 10;
   velocityVariance = 5.75;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 40;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = 0;
   lifetimeMS       = "";
   particles = "HandGrenadeSparks";
};

datablock ExplosionData(HandGrenadeSubExplosion1)
{
   offset = 0.0;
   shapeFile = "effect_plasma_explosion.dts";
   explosionScale = "2.5 2.5 2.5";
   emitter[0] = HandGrenadeExplosionSmokeEmitter;
   emitter[1] = HandGrenadeSparkEmitter;
};

datablock ExplosionData(HandGrenadeSubExplosion2)
{
   offset = 0;
   shapeFile = "effect_plasma_explosion.dts";
   explosionScale = "3.5 3.5 3.5";
   emitter[0] = HandGrenadeExplosionSmokeEmitter;
   emitter[1] = HandGrenadeSparkEmitter;
};
//datablock ParticleData( FDebrisSmokeParticle )
//{
//   dragCoeffiecient     = 1.0;
//   gravityCoefficient   = -0.5;
//   inheritedVelFactor   = 0.2;
//
//   lifetimeMS           = 250;
//   lifetimeVarianceMS   = 100;
//
//   textureName          = "particleTest";
//
//   useInvAlpha =     false;
//
//   spinRandomMin = -60.0;
//   spinRandomMax = 60.0;
//
//   colors[0]     = "0.0 0.0 1 1.0";
//   colors[1]     = "0.0 0.0 1 0.5";
//   colors[2]     = "0.0 0.0 0.5 0.0";
//   sizes[0]      = 0.0;
//   sizes[1]      = 1.0;
//   sizes[2]      = 1.0;
//   times[0]      = 0.0;
//   times[1]      = 0.5;
//   times[2]      = 1.0;
//};
//
//datablock ParticleEmitterData( FDebrisSmokeEmitter )
//{
//   ejectionPeriodMS = 10;
//   periodVarianceMS = 1;
//
//   ejectionVelocity = 1.0;  // A little oomph at the back end
//   velocityVariance = 0.2;
//
//   thetaMin         = 0.0;
//   thetaMax         = 40.0;
//
//   particles = "FDebrisSmokeParticle";
//};
//
//
//datablock DebrisData( FlameDebris )
//{
//   emitters[0] = FDebrisSmokeEmitter;
//
//   explodeOnMaxBounce = true;
//
//   elasticity = 0.4;
//   friction = 0.2;
//
//   lifetime = 0.78;
//   lifetimeVariance = 0.1;
//
//   numBounces = 1;
//};
//
//datablock ParticleData(FlameDust)
//{
//   dragCoefficient      = 1.0;
//   gravityCoefficient   = -1.0;
//   inheritedVelFactor   = 0.0;
//   constantAcceleration = 0.0;
//   lifetimeMS           = 800;
//   lifetimeVarianceMS   = 100;
//   useInvAlpha          = false;
//   spinRandomMin        = -90.0;
//   spinRandomMax        = 500.0;
//   textureName          = "particleTest";
//   colors[0]     = "1.0 0.0 0.0 0.5";
//   colors[1]     = "1.0 0.0 0.0 0.5";
//   colors[2]     = "0.5 0.0 0.0 0.0";
//   sizes[0]      = 1.2;
//   sizes[1]      = 0.6;
//   sizes[2]      = 1.0;
//   times[0]      = 0.0;
//   times[1]      = 0.7;
//   times[2]      = 1.0;
//};
//
//datablock ParticleEmitterData(FlameDustEmitter)
//{
//   ejectionPeriodMS = 7;
//   periodVarianceMS = 0;
//   ejectionVelocity = 6.0;
//   velocityVariance = 0.0;
//   ejectionOffset   = 0.0;
//   thetaMin         = 85;
//   thetaMax         = 85;
//   phiReferenceVel  = 0;
//   phiVariance      = 360;
//   overrideAdvances = false;
//   lifetimeMS       = 6000;
//   particles = "FlameDust";
//};
//
//
//datablock ParticleData(FlameExplosionSmoke)
//{
//   dragCoeffiecient     = 0.4;
//   gravityCoefficient   = -1.0;   // rises slowly
//   inheritedVelFactor   = 0.025;
//
//   lifetimeMS           = 1250;
//   lifetimeVarianceMS   = 0;
//
//   textureName          = "particleTest";
//
//   useInvAlpha =  false;
//   spinRandomMin = -200.0;
//   spinRandomMax =  200.0;
//
//   textureName = "special/Smoke/smoke_001";
//
//   colors[0]     = "1.0 1.0 1.0 1.0";
//   colors[1]     = "1.0 1.0 1.0 1.0";
//   colors[2]     = "1.0 1.0 1.0 0.0";
//   sizes[0]      = 2.0;
//   sizes[1]      = 3.0;
//   sizes[2]      = 2.0;
//   times[0]      = 0.0;
//   times[1]      = 0.5;
//   times[2]      = 1.0;
//
//};
//
//datablock ParticleEmitterData(FExplosionSmokeEmitter)
//{
//   ejectionPeriodMS = 7;
//   periodVarianceMS = 0;
//
//   ejectionVelocity = 4.25;
//   velocityVariance = 0.25;
//
//   thetaMin         = 0.0;
//   thetaMax         = 90.0;
//
//   lifetimeMS       = 6000;
//
//   particles = "FlameExplosionSmoke";
//};
//
//
//
//datablock ParticleData(FlameSparks)
//{
//   dragCoefficient      = 1;
//   gravityCoefficient   = -3.0;
//   inheritedVelFactor   = 0.2;
//   constantAcceleration = 0.0;
//   lifetimeMS           = 1000;
//   lifetimeVarianceMS   = 350;
//   textureName          = "special/bigspark";
//   colors[0]     = "1.0 0.0 0.3 1.0";
//   colors[1]     = "1.0 1.0 1 1.0";
//   colors[2]     = "0.0 0.0 1 0.0";
//   sizes[0]      = 0.5;
//   sizes[1]      = 0.5;
//   sizes[2]      = 0.75;
//   times[0]      = 0.0;
//   times[1]      = 0.5;
//   times[2]      = 1.0;
//
//};
//
//datablock ParticleEmitterData(FlameSparksEmitter)
//{
//   ejectionPeriodMS = 2;
//   periodVarianceMS = 0;
//   ejectionVelocity = 8;
//   velocityVariance = 0;
//   ejectionOffset   = 0.0;
//   thetaMin         = 0;
//   thetaMax         = 60;
//   phiReferenceVel  = 0;
//   phiVariance      = 360;
//   overrideAdvances = false;
//   orientParticles  = true;
//   lifetimeMS       = 6000;
//   particles = "FlameSparks";
//};




//----------------------------------------------------
//  Explosion
//----------------------------------------------------
datablock ExplosionData(HandGrenadeExplosion)
{
   soundProfile   = GrenadeExplosionSound;

   faceViewer           = false;
   explosionScale = "2.5 2.5 2.5";

   //debris = FlameDebris;
   //debrisThetaMin = 10;
   //debrisThetaMax = 50;
   //debrisNum = 14;
   //debrisVelocity = 16.0;
  // debrisVelocityVariance = 0;

   //emitter[0] = FlameDustEmitter;
  // emitter[1] = FExplosionSmokeEmitter;
  // emitter[2] = FlameSparksEmitter;
   emitter[0] = HandGrenadeExplosionSmokeEmitter;
   emitter[1] = HandGrenadeSparkEmitter;
   
   subExplosion[0] = HandGrenadeSubExplosion1;
   subExplosion[1] = HandGrenadeSubExplosion2;

   shakeCamera = true;
   camShakeFreq = "10.0 6.0 9.0";
   camShakeAmp = "20.0 20.0 20.0";
   camShakeDuration = 0.2;
   camShakeRadius = 5.0;
};



//----------------------------------------------------
//  Explosion
//----------------------------------------------------







datablock ItemData(GrenadeThrown)
{
	className = Weapon;
	shapeFile = "grenade.dts";
	mass = 0.7;
	elasticity = 0.2;
   friction = 1;
   pickupRadius = 2;
   maxDamage = 0.5;
	explosion = HandGrenadeExplosion;
	underwaterExplosion = UnderwaterHandGrenadeExplosion;
   indirectDamage      = 0.4;
   damageRadius        = 10.0;
   radiusDamageType    = $DamageType::Grenade;
   kickBackStrength    = 2000;

   computeCRC = true;

};

datablock ItemData(Grenade)
{
	className = HandInventory;
	catagory = "Handheld";
	shapeFile = "grenade.dts";
	mass = 0.7;
	elasticity = 0.2;
   friction = 1;
   pickupRadius = 2;
   thrownItem = GrenadeThrown;
	pickUpName = "some grenades";
	isGrenade = true;

   computeCRC = true;

};

