//--------------------------------------------------------------------------
// Force-Feedback Effects
//--------------------------------------
datablock EffectProfile(PlasmaSwitchEffect)
{
   effectname = "weapons/plasma_rifle_activate";
   minDistance = 2.5;
   maxDistance = 2.5;
};

datablock EffectProfile(PlasmaFireEffect)
{
   effectname = "weapons/plasma_fire";
   minDistance = 2.5;
   maxDistance = 2.5;
};

datablock EffectProfile(PlasmaDryFireEffect)
{
   effectname = "weapons/plasma_dryfire";
   minDistance = 2.5;
   maxDistance = 2.5;
};

datablock EffectProfile(PlasmaIdleEffect)
{
   effectname = "weapons/plasma_rifle_idle";
   minDistance = 2.5;
};

datablock EffectProfile(PlasmaReloadEffect)
{
   effectname = "weapons/plasma_rifle_reload";
   minDistance = 2.5;
   maxDistance = 2.5;
};

datablock EffectProfile(PlasmaExpEffect)
{
   effectname = "explosions/explosion.xpl10";
   minDistance = 10;
   maxDistance = 25;
};

//--------------------------------------------------------------------------
// Sounds
//--------------------------------------
datablock AudioProfile(PlasmaSwitchSound)
{
   filename    = "fx/weapons/plasma_rifle_activate.wav";
   description = AudioClosest3d;
   preload = true;
   effect = PlasmaSwitchEffect;
};

datablock AudioProfile(PlasmaFireSound)
{
   filename    = "fx/weapons/plasma_rifle_fire.wav";
   description = AudioDefault3d;
   preload = true;
   effect = PlasmaFireEffect;
};

datablock AudioProfile(PlasmaIdleSound)
{
   filename    = "fx/weapons/plasma_rifle_idle.wav";
   description = ClosestLooping3d;
   preload = true;
   //effect = PlasmaIdleEffect;
};

datablock AudioProfile(PlasmaReloadSound)
{
   filename    = "fx/weapons/plasma_rifle_reload.wav";
   description = Audioclosest3d;
   preload = true;
   effect = PlasmaReloadEffect;
};

datablock AudioProfile(PlasmaExpSound)
{
   filename    = "fx/explosions/explosion.xpl10.wav";
   description = AudioExplosion3d;
   effect = PlasmaExpEffect;
};

datablock AudioProfile(PlasmaProjectileSound)
{
   filename    = "fx/weapons/plasma_rifle_projectile.WAV";
   description = ProjectileLooping3d;
   preload = true;
};

datablock AudioProfile(PlasmaDryFireSound)
{
   filename    = "fx/weapons/plasma_dryfire.wav";
   description = AudioClose3d;
   preload = true;
   effect = PlasmaDryFireEffect;
};

datablock AudioProfile(PlasmaFireWetSound)
{
   filename    = "fx/weapons/plasma_fizzle.wav";
   description = AudioClose3d;
   preload = true;
};
//--------------------------------------------------------------------------
// Explosion
//--------------------------------------
datablock ParticleData(PlasmaExplosionParticle)
{
   dragCoefficient      = 2;
   gravityCoefficient   = 0.2;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 750;
   lifetimeVarianceMS   = 150;
   textureName          = "particleTest";
   colors[0]     = "1.0 0.0 0.0 1.0";
   colors[1]     = "1.0 0.0 0.0 0.0";
   sizes[0]      = 0.05;
   sizes[1]      = 0.5;
};
datablock ParticleEmitterData(PlasmaExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 5;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 60;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   particles = "PlasmaExplosionParticle";
};

datablock ExplosionData(PlasmaBoltExplosion)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 1.25;
   faceViewer = true;

   sizes[0] = "1.0 1.0 1.0";
   sizes[1] = "1.0 1.0 1.0";
   times[0] = 0.0;
   times[1] = 1.5;
};

datablock ExplosionData(PlasmaBoltExplosion2)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 2.5;
   faceViewer = true;

   sizes[0] = "5.5 5.5 5.5";
   sizes[1] = "5.5 5.5 5.5";
   times[0] = 0.0;
   times[1] = 1.5;
};

datablock ExplosionData(PlasmaBoltExplosion3)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 3.75;
   faceViewer = true;

   sizes[0] = "10.25 10.25 10.25";
   sizes[1] = "10.25 10.25 10.25";
   times[0] = 0.0;
   times[1] = 1.5;
};

datablock ExplosionData(PlasmaBoltExplosion4)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 5.00;
   faceViewer = true;

   sizes[0] = "20.375 20.375 20.375";
   sizes[1] = "20.375 20.375 20.375";
   times[0] = 0.0;
   times[1] = 1.5;
};

datablock ExplosionData(PlasmaBoltExplosion5)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 6.25;
   faceViewer = true;

   sizes[0] = "25.0625 25.0625 25.0625";
   sizes[1] = "25.0625 25.0625 25.0625";
   times[0] = 0.0;
   times[1] = 1.5;
};

datablock ExplosionData(PlasmaBoltExplosion6)
{
   explosionShape = "effect_plasma_explosion.dts";
   soundProfile   = PlasmaExpSound;
   particleEmitter = PlasmaExplosionEmitter;
   particleDensity = 150;
   particleRadius = 7.5;
   faceViewer = true;

   sizes[0] = "35.59 35.59 35.59";
   sizes[1] = "35.59 35.59 35.59";
   times[0] = 0.0;
   times[1] = 1.5;
};

//--------------------------------------------------------------------------
// Splash
//--------------------------------------------------------------------------
datablock ParticleData(PlasmaMist)
{
   dragCoefficient      = 2.0;
   gravityCoefficient   = -0.05;
   inheritedVelFactor   = 0.0;
   constantAcceleration = 0.0;
   lifetimeMS           = 400;
   lifetimeVarianceMS   = 100;
   useInvAlpha          = false;
   spinRandomMin        = -90.0;
   spinRandomMax       = 500.0;
   textureName          = "particleTest";
   colors[0]     = "0.7 0.8 1.0 1.0";
   colors[1]     = "0.7 0.8 1.0 0.5";
   colors[2]     = "0.7 0.8 1.0 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 0.5;
   sizes[2]      = 0.8;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(PlasmaMistEmitter)
{
   ejectionPeriodMS = 5;
   periodVarianceMS = 0;
   ejectionVelocity = 3.0;
   velocityVariance = 2.0;
   ejectionOffset   = 0.0;
   thetaMin         = 85;
   thetaMax         = 85;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   lifetimeMS       = 250;
   particles = "PlasmaMist";
};

datablock ParticleData( PlasmaSplashParticle2 )
{

   dragCoeffiecient     = 0.4;
   gravityCoefficient   = -0.03;   // rises slowly
   inheritedVelFactor   = 0.025;

   lifetimeMS           = 600;
   lifetimeVarianceMS   = 300;

   textureName          = "particleTest";

   useInvAlpha =  false;
   spinRandomMin = -200.0;
   spinRandomMax =  200.0;


   colors[0]     = "0.7 0.8 1.0 1.0";
   colors[1]     = "0.7 0.8 1.0 0.5";
   colors[2]     = "0.7 0.8 1.0 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 1.0;
   sizes[2]      = 2.0;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData( PlasmaSplashEmitter2 )
{
   ejectionPeriodMS = 25;
   ejectionOffset = 0.2;
   periodVarianceMS = 0;
   ejectionVelocity = 2.25;
   velocityVariance = 0.50;
   thetaMin         = 0.0;
   thetaMax         = 30.0;
   lifetimeMS       = 250;

   particles = "PlasmaSplashParticle2";
};


datablock ParticleData( PlasmaSplashParticle )
{
   dragCoefficient      = 1;
   gravityCoefficient   = 0.2;
   inheritedVelFactor   = 0.2;
   constantAcceleration = -0.0;
   lifetimeMS           = 600;
   lifetimeVarianceMS   = 0;
   textureName          = "special/droplet";
   colors[0]     = "0.7 0.8 1.0 1.0";
   colors[1]     = "0.7 0.8 1.0 0.5";
   colors[2]     = "0.7 0.8 1.0 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 0.5;
   sizes[2]      = 0.5;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData( PlasmaSplashEmitter )
{
   ejectionPeriodMS = 1;
   periodVarianceMS = 0;
   ejectionVelocity = 3;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 60;
   thetaMax         = 80;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = true;
   lifetimeMS       = 100;
   particles = "PlasmaSplashParticle";
};


datablock SplashData(PlasmaSplash)
{
   numSegments = 15;
   ejectionFreq = 0.0001;
   ejectionAngle = 45;
   ringLifetime = 0.5;
   lifetimeMS = 400;
   velocity = 5.0;
   startRadius = 0.0;
   acceleration = -3.0;
   texWrap = 5.0;

   texture = "special/water2";

   emitter[0] = PlasmaSplashEmitter;
   emitter[1] = PlasmaSplashEmitter2;
   emitter[2] = PlasmaMistEmitter;

   colors[0] = "0.7 0.8 1.0 0.0";
   colors[1] = "0.7 0.8 1.0 1.0";
   colors[2] = "0.7 0.8 1.0 0.0";
   colors[3] = "0.7 0.8 1.0 0.0";
   times[0] = 0.0;
   times[1] = 0.4;
   times[2] = 0.8;
   times[3] = 1.0;
};

//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock ParticleData(PlasmaParticle)
{
   dragCoefficient      = 2.75;
   gravityCoefficient   = 0.1;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   lifetimeMS           = 550;
   lifetimeVarianceMS   = 0;
   textureName          = "particleTest";
   colors[0]     = "1.0 0.0 0.0 1.0";
   colors[1]     = "1.0 0.0 0.0 0.0";
   sizes[0]      = 0.25;
   sizes[1]      = 0.20;
};
datablock ParticleEmitterData(PlasmaRifleEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 10;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 12;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance  = true;
   particles = "PlasmaParticle";
};



//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock LinearFlareProjectileData(PlasmaBolt1)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "2.0 2.0 2.0";
   faceViewer          = true;
   directDamage        = 0.2;
   hasDamageRadius     = true;
   indirectDamage      = 0.2;
   damageRadius        = 2;
   kickBackStrength    = 0.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion";
   splash              = PlasmaSplash;

   dryVelocity       = 151.875;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 4938;
   lifetimeMS        = 5938;
   explodeOnDeath    = false;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.1;
   size[1]           = 0.25;
   size[2]           = 0.05;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};

datablock LinearFlareProjectileData(PlasmaBolt2)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "3.0 3.0 3.0";
   faceViewer          = true;
   directDamage        = 0.3;
   hasDamageRadius     = true;
   indirectDamage      = 0.3;
   damageRadius        = 4;
   kickBackStrength    = 0.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion2";
   splash              = PlasmaSplash;

   dryVelocity       = 101.25;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 7407;
   lifetimeMS        = 8407;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.2;
   size[1]           = 0.5;
   size[2]           = 0.1;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};

datablock LinearFlareProjectileData(PlasmaBolt3)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "6.5 6.5 6.5";
   faceViewer          = true;
   directDamage        = 0.5;
   hasDamageRadius     = true;
   indirectDamage      = 0.5;
   damageRadius        = 6;
   kickBackStrength    = 5.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion3";
   splash              = PlasmaSplash;

   dryVelocity       = 67.5;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 11111;
   lifetimeMS        = 12111;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.3;
   size[1]           = 0.75;
   size[2]           = 0.15;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};

datablock LinearFlareProjectileData(PlasmaBolt4)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "10.75 10.75 10.75";
   faceViewer          = true;
   directDamage        = 0.8;
   hasDamageRadius     = true;
   indirectDamage      = 0.8;
   damageRadius        = 8;
   kickBackStrength    = 20.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion4";
   splash              = PlasmaSplash;

   dryVelocity       = 45.0;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 16667;
   lifetimeMS        = 17667;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.4;
   size[1]           = 1.0;
   size[2]           = 0.2;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};

datablock LinearFlareProjectileData(PlasmaBolt5)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "30.125 30.125 30.125";
   faceViewer          = true;
   directDamage        = 1.1;
   hasDamageRadius     = true;
   indirectDamage      = 1.1;
   damageRadius        = 10;
   kickBackStrength    = 45.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion5";
   splash              = PlasmaSplash;

   dryVelocity       = 30.0;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 25000;
   lifetimeMS        = 26000;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.5;
   size[1]           = 1.25;
   size[2]           = 0.25;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};

datablock LinearFlareProjectileData(PlasmaBolt6)
{
   projectileShapeName = "plasmabolt.dts";
   scale               = "50.1875 50.1875 50.1875";
   faceViewer          = true;
   directDamage        = 1.5;
   hasDamageRadius     = true;
   indirectDamage      = 1.5;
   damageRadius        = 15;
   kickBackStrength    = 1000.0;
   radiusDamageType    = $DamageType::Plasma;

   explosion           = "PlasmaBoltExplosion6";
   splash              = PlasmaSplash;

   dryVelocity       = 20.0;
   wetVelocity       = -1;
   velInheritFactor  = 0.3;
   fizzleTimeMS      = 37500;
   lifetimeMS        = 40000;
   explodeOnDeath    = true;
   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = true;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = -1;

   //activateDelayMS = 100;
   activateDelayMS = -1;

   size[0]           = 0.6;
   size[1]           = 1.5;
   size[2]           = 0.3;


   numFlares         = 35;
   flareColor        = "1 0.75 0.25";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "flarebase";

	sound        = PlasmaProjectileSound;
   fireSound    = PlasmaFireSound;
   wetFireSound = PlasmaFireWetSound;

   hasLight    = true;
   lightRadius = 3.0;
   lightColor  = "1 0.75 0.25";
};


//--------------------------------------------------------------------------
// Ammo
//--------------------------------------

datablock ItemData(PlasmaAmmo)
{
   className = Ammo;
   catagory = "Ammo";
   shapeFile = "ammo_plasma.dts";
   mass = 1;
   elasticity = 0.2;
   friction = 0.6;
   pickupRadius = 2;
	pickUpName = "some plasma cannon ammo";
};

//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(Plasma)
{
   className = Weapon;
   catagory = "Spawn Items";
   shapeFile = "weapon_plasma.dts";
   image = PlasmaImage;
   mass = 1;
   elasticity = 0.2;
   friction = 0.6;
   pickupRadius = 2;
	pickUpName = "A Plasma Cannon";
};

datablock ShapeBaseImageData(PlasmaImage)
{
   className = WeaponImage;
   shapeFile = "turret_fusion_large.dts";
   item = Plasma;
   showname = "Plasma Cannon";
   ammo = PlasmaAmmo;
   offset = "0 0 0";
   armthread = lookde;

   projectile = PlasmaBolt;
   projectileType = LinearFlareProjectile;

   stateName[0] = "Activate";
   stateTransitionOnTimeout[0] = "ActivateReady";
   stateTimeoutValue[0] = 0.5;
   stateSequence[0] = "Activate";
   stateSound[0] = PlasmaSwitchSound;

   stateName[1] = "ActivateReady";
   stateTransitionOnLoaded[1] = "Ready";
   stateTransitionOnNoAmmo[1] = "NoAmmo";

   stateName[2] = "Ready";
   stateTransitionOnNoAmmo[2] = "NoAmmo";
   stateTransitionOnTriggerDown[2] = "Charge";

   stateName[3] = "Charge";
   stateTransitionOnNoAmmo[3] = "NoAmmo";
   stateTransitionOnTimeout[3] = "Charge";
   stateTimeoutValue[3] = 0.1;
   stateScript[3] = "onCharge";
   stateTransitionOnTriggerUp[3] = "CheckWet";

   stateName[4] = "Fire";
   stateTransitionOnTimeout[4] = "Reload";
   stateTimeoutValue[4] = 0.1;
   stateFire[4] = true;
   stateRecoil[4] = LightRecoil;
   stateAllowImageChange[4] = false;
   stateScript[4] = "onFire";
   stateEmitterTime[4] = 0.2;
   stateSound[4] = PlasmaFireSound;

   stateName[5] = "Reload";
   stateTransitionOnNoAmmo[5] = "NoAmmo";
   stateTransitionOnTimeout[5] = "Ready";
   stateTimeoutValue[5] = 0.6;
   stateAllowImageChange[5] = false;
   stateSequence[5] = "Reload";
   stateSound[5] = PlasmaReloadSound;

   stateName[6] = "NoAmmo";
   stateTransitionOnAmmo[6] = "Reload";
   stateSequence[6] = "NoAmmo";
   stateTransitionOnTriggerDown[6] = "DryFire";

   stateName[7]       = "DryFire";
   stateSound[7]      = PlasmaDryFireSound;
   stateTimeoutValue[7]        = 1.5;
   stateTransitionOnTimeout[7] = "NoAmmo";

   stateName[8]       = "WetFire";
   stateSound[8]      = PlasmaFireWetSound;
   stateTimeoutValue[8]        = 1.5;
   stateTransitionOnTimeout[8] = "Ready";

   stateName[9]               = "CheckWet";
   stateTransitionOnWet[9]    = "WetFire";
   stateTransitionOnNotWet[9] = "Fire";
};
datablock ParticleData(PlasmaSparks)
{
   dragCoefficient      = 1;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 1.2;
   constantAcceleration = -0.2;
   lifetimeMS           = 2500;
   lifetimeVarianceMS   = 0;
   textureName          = "special/blueSpark";
   colors[0]     = "0.8 0.8 1.0 1.0";
   colors[1]     = "0.8 0.8 1.0 1.0";
   colors[2]     = "0.8 0.8 1.0 0.0";
   sizes[0]      = 0.75;
   sizes[1]      = 0.45;
   sizes[2]      = 0.0;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;

};

datablock ParticleEmitterData(PlasmaSparksEmitter)
{
   ejectionPeriodMS = 5;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   velocityVariance = 0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 180;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = true;
   lifetimeMS       = 1500;
   particles = "PlasmaSparks";
};
function PlasmaImage::onCharge(%data, %obj, %slot)
{
   if (%obj.cannonfire == 0)
      %obj.cannonfire = 2;
   else
      %obj.cannonfire += 1;
   %obj.client.player.setHeat(1);

   if (%obj.cannoncount $= "")
      %obj.cannoncount = 2;
   %obj.cannoncount += 1;
   if (%obj.cannoncount > 10)
      %obj.cannoncount = 1;
   %pos = %obj.getMuzzlePoint(%slot);
   if ((%obj.cannonfire < 100))
   {
//  	  createLifeEmitter(%pos, ChargeEmitter, 5000);
      %message = "Powering Up - " @ %obj.cannonfire @ "\%";
      CommandToClient(%obj.client, 'BottomPrint', %message, 2, 1 );
   }
   else if (%obj.cannoncount == 1)
   {
      %message = "Powered UP!";
      CommandToClient(%obj.client, 'BottomPrint', %message, 2, 1 );
   }
}

function PlasmaImage::onFire(%data, %obj, %slot)
{

   %obj.client.player.setHeat(1);
   if ((%obj.cannonfire > 99) && (%obj.getInventory( %data.ammo ) > 19))
   {
      %datab = PlasmaBolt6;
      %ammoloss = 20;
   }
   else if ((%obj.cannonfire > 79) && (%obj.getInventory( %data.ammo ) > 14))
   {
      %datab = PlasmaBolt5;
      %ammoloss = 5;
   }
   else if ((%obj.cannonfire > 59) && (%obj.getInventory( %data.ammo ) > 9))
   {
      %datab = PlasmaBolt4;
      %ammoloss = 3;
   }
   else if ((%obj.cannonfire > 39) && (%obj.getInventory( %data.ammo ) > 4))
   {
      %datab = PlasmaBolt3;
      %ammoloss = 2;
   }
   else if ((%obj.cannonfire > 19) && (%obj.getInventory( %data.ammo ) > 1))
   {
      %datab = PlasmaBolt2;
      %ammoloss = 1;
   }
   else
   {
      %datab = PlasmaBolt1;
      %ammoloss = 1;
   }

   %p = new (%data.projectileType)() {
      dataBlock        = %datab;
      initialDirection = %obj.getMuzzleVector(%slot);
      initialPosition  = %obj.getMuzzlePoint(%slot);
      sourceObject     = %obj;
      sourceSlot       = %slot;
      vehicleObject    = %vehicle;
   };

   if (isObject(%obj.lastProjectile) && %obj.deleteLastProjectile)
      %obj.lastProjectile.delete();

   %obj.lastProjectile = %p;
   %obj.deleteLastProjectile = %data.deleteLastProjectile;
   MissionCleanup.add(%p);

   // AI hook
   if(%obj.client)
      %obj.client.projectile = %p;

   %obj.decInventory(%data.ammo, %ammoloss);
   %obj.cannonfire = 0;
   %obj.cannoncount = 2;
}

function PlasmaImage::onUnmount(%this, %obj, %slot)
{
   %obj.cannonfire = 0;
   %obj.cannoncount = 2;
   Parent::onMount(%this,%obj,%slot);
}

//weapon info.
function YourWeaponImage::onMount(%this,%obj,%slot)
{
  Parent::onMount(%this,%obj,%slot);
  CommandToClient(%obj.client, 'BottomPrint', "Charging Plasma Rifle!!!", 5, 2 );
}

