//--------------------------------------
// swaper Gun
//--------------------------------------

datablock ExplosionData(swaperBoltExplosion)
{
   soundProfile   = NerfBoltExpSound;
   emitter[0]     = NerfBoltExplosionEmitter;
   emitter[1]     = NerfBoltExplosionEmitter2;
};


//--------------------------------------------------------------------------
// Projectile
//--------------------------------------

datablock LinearFlareProjectileData(swaperBolt)
{
   emitterDelay        = -1;
   directDamage        = 0;
   directDamageType    = $DamageType::Default;
   kickBackStrength    = 0.0;
   bubbleEmitTime      = 1.0;

   sound = NerfBoltProjectileSound;
   velInheritFactor    = 0.5;

   explosion           = "swaperBoltExplosion";
   splash              = BlasterSplash;

   grenadeElasticity = 0.998;
   grenadeFriction   = 0.0;
   armingDelayMS     = 500;

   muzzleVelocity    = 100.0;

   drag = 0.05;

   gravityMod        = 0.0;

   dryVelocity       = 100.0;
   wetVelocity       = 80.0;

   reflectOnWaterImpactAngle = 0.0;
   explodeOnWaterImpact      = false;
   deflectionOnWaterImpact   = 0.0;
   fizzleUnderwaterMS        = 3000;

   lifetimeMS     = 3000;

   scale             = "0.1 0.1 0.1";
   numFlares         = 8;
   flareColor        = "0.1 1 0.1";
   flareModTexture   = "flaremod";
   flareBaseTexture  = "special/lightFalloffMono";
};


//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(swaperGunImage)
{
   className = WeaponImage;
   shapeFile = "weapon_energy.dts";
   item = swaperGun;

   projectile = swaperfBolt;
   projectileType = LinearFlareProjectile;

   usesEnergy = true;
   fireEnergy = 4;
   minEnergy = 4;

   stateName[0] = "Activate";
   stateTransitionOnTimeout[0] = "ActivateReady";
   stateTimeoutValue[0] = 0.5;
   stateSequence[0] = "Activate";
   stateSound[0] = BlasterSwitchSound;

   stateName[1] = "ActivateReady";
   stateTransitionOnLoaded[1] = "Ready";
   stateTransitionOnNoAmmo[1] = "NoAmmo";

   stateName[2] = "Ready";
   stateTransitionOnNoAmmo[2] = "NoAmmo";
   stateTransitionOnTriggerDown[2] = "Fire";

   stateName[3] = "Fire";
   stateTransitionOnTimeout[3] = "Reload";
   stateTimeoutValue[3] = 0.3;
   stateFire[3] = true;
   stateRecoil[3] = NoRecoil;
   stateAllowImageChange[3] = false;
   stateSequence[3] = "Fire";
   stateSound[3] = NerfGunFireSound;
   stateScript[3] = "onFire";

   stateName[4] = "Reload";
   stateTransitionOnNoAmmo[4] = "NoAmmo";
   stateTransitionOnTimeout[4] = "Ready";
   stateAllowImageChange[4] = false;
   stateSequence[4] = "Reload";

   stateName[5] = "NoAmmo";
   stateTransitionOnAmmo[5] = "Reload";
   stateSequence[5] = "NoAmmo";
   stateTransitionOnTriggerDown[5] = "DryFire";
   
   stateName[6] = "DryFire";
   stateTimeoutValue[6] = 0.3;
   stateSound[6] = NerfGunDryFireSound;
   stateTransitionOnTimeout[6] = "Ready";
};

datablock ItemData(swaperGun)
{
   className = Weapon;
   catagory = "Spawn Items";
   shapeFile = "weapon_energy.dts";
   image = swaperGunImage;
   mass = 1;
   elasticity = 0.2;
   friction = 0.6;
   pickupRadius = 2;
	pickUpName = "a swaper gun";
};

function NerfBolt::onCollision(%data,%projectile,%targetObject,%modifier,%position,%normal) {
	if (isObject(%targetObject)) {
		if (%targetObject.getClassName() $= "Player")
			applyNerf(%targetObject,%projectile.sourceObject,%position);
	}
	Parent::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal);
}

