
//**************************************************************
// WILDCAT GRAV CYCLE
//**************************************************************
//**************************************************************
// SOUNDS
//**************************************************************

datablock AudioProfile(ScoutSqueelSound)
{
   filename    = "fx/vehicles/outrider_skid.wav";
   description = ClosestLooping3d;
   preload = true;
};

// Scout
datablock AudioProfile(ScoutEngineSound)
{
   filename    = "fx/vehicles/outrider_engine.wav";
   description = AudioDefaultLooping3d;
   preload = true;
};

datablock AudioProfile(ScoutThrustSound)
{
   filename    = "fx/vehicles/outrider_boost.wav";
   description = AudioDefaultLooping3d;
   preload = true;
};

//**************************************************************
// LIGHTS
//**************************************************************
datablock RunningLightData(WildcatLight1)
{
   radius = 1.0;
   color = "1.0 1.0 1.0 0.3";
   nodeName = "Headlight_node01";
   direction = "-1.0 1.0 0.0";
   texture = "special/headlight4";
};

datablock RunningLightData(WildcatLight2)
{
   radius = 1.0;
   color = "1.0 1.0 1.0 0.3";
   nodeName = "Headlight_node02";
   direction = "1.0 1.0 0.0";
   texture = "special/headlight4";
};

datablock RunningLightData(WildcatLight3)
{
   type = 2;
   radius = 100.0;
   color = "1.0 1.0 1.0 1.0";
   offset = "0.0 0.0 0.0";
   direction = "0.0 1.0 0.0";
   texture = "special/projheadlight";
};

//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************

datablock HoverVehicleData(ScoutVehicle) : WildcatDamageProfile
{
   spawnOffset = "0 0 1";

   floatingGravMag = 3.5;

   catagory = "Vehicles";
   shapeFile = "vehicle_grav_scout.dts";
   computeCRC = true;

   debrisBase = 3;
   debrisVariance = 3;
   debrisShapeName = "vehicle_grav_scout_debris.dts";
//   debris = ShapeDebris;
   debrisEjectionScale = 1.0;

   renderWhenDestroyed = false;

   drag = 0.0;
   density = 0.9;

   mountPose[0] = scoutRoot;
   cameraMaxDist = 5.0;
   cameraOffset = 0.7;
   cameraLag = 0.5;
   numMountPoints = 1;
   isProtectedMountPoint[0] = true;
   explosion = VehicleExplosion;
   explosionDamage = 1.0;
   explosionRadius = 18.0;
   explosionImpulse = 1800;

   lightOnly = true;

   maxDamage = 0.60;
   destroyedLevel = 0.60;

   isShielded = true;
   rechargeRate = 0.4;
   energyPerDamagePoint = 140;
   maxEnergy = 150;
   minJetEnergy = 15;
   jetEnergyDrain = 1.3;
   BoostEnergyDrain = 35;

   // Rigid Body
   mass = 300;
   bodyFriction = 0.1;
   bodyRestitution = 0.5;  
   softImpactSpeed = 20;       // Play SoftImpact Sound
   hardImpactSpeed = 28;      // Play HardImpact Sound

   ELFDrain  = 1.5;

   // Ground Impact Damage (uses DamageType::Ground)
   minImpactSpeed = 55;
   speedDamageScale = 0.007;

   // Object Impact Damage (uses DamageType::Impact)
   collDamageThresholdVel = 30;
   collDamageMultiplier   = 0.02;

   dragForce            = 25 / 45.0;
   vertFactor           = 0.0;
   floatingThrustFactor = 0.35;

   mainThrustForce    = 30;
   reverseThrustForce = 12;
   strafeThrustForce  = 8;
   turboFactor        = 1.7;

   brakingForce = 25;
   brakingActivationSpeed = 4;

   stabLenMin = 2.25;
   stabLenMax = 3.25;
   stabSpringConstant  = 30;
   stabDampingConstant = 12;

   gyroDrag = 16;
   normalForce = 30;
   restorativeForce = 25;
   steeringForce = 28;
   rollForce  = 15;
   pitchForce = 7;

   dustEmitter = VehicleLiftoffDustEmitter;
   triggerDustHeight = 2.5;
   dustHeight = 1.0;
   dustTrailEmitter = TireEmitter;
   dustTrailOffset = "0.0 -1.0 0.5";
   triggerTrailHeight = 3.6;
   dustTrailFreqMod = 15.0;

   jetSound         = ScoutSqueelSound;
   engineSound      = ScoutEngineSound;
   floatSound       = ScoutThrustSound;
   softImpactSound  = GravSoftImpactSound;
   hardImpactSound  = HardImpactSound;
   wheelImpactSound = WheelImpactSound;

   //
   softSplashSoundVelocity = 10.0; 
   mediumSplashSoundVelocity = 20.0;   
   hardSplashSoundVelocity = 30.0;   
   exitSplashSoundVelocity = 10.0;
   
   exitingWater      = VehicleExitWaterSoftSound;
   impactWaterEasy   = VehicleImpactWaterSoftSound;
   impactWaterMedium = VehicleImpactWaterSoftSound;
   impactWaterHard   = VehicleImpactWaterMediumSound;
   waterWakeSound    = VehicleWakeSoftSplashSound; 

   minMountDist = 4;

   damageEmitter[0] = SmallLightDamageSmoke;
   damageEmitter[1] = SmallHeavyDamageSmoke;
   damageEmitter[2] = DamageBubbles;
   damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
   damageLevelTolerance[0] = 0.3;
   damageLevelTolerance[1] = 0.7;
   numDmgEmitterAreas = 1;

   splashEmitter[0] = VehicleFoamDropletsEmitter;
   splashEmitter[1] = VehicleFoamEmitter;

   shieldImpact = VehicleShieldImpact;
   
   forwardJetEmitter = WildcatJetEmitter;

   cmdCategory = Tactical;
   cmdIcon = CMDHoverScoutIcon;
   cmdMiniIconName = "commander/MiniIcons/com_landscout_grey";
   targetNameTag = 'WildCat';
   targetTypeTag = 'Grav Cycle';
   sensorData = VehiclePulseSensor;

   checkRadius = 1.7785;
   observeParameters = "1 10 10";

   runningLight[0] = WildcatLight1;
   runningLight[1] = WildcatLight2;
   runningLight[2] = WildcatLight3;

   shieldEffectScale = "0.9375 1.125 0.6";
};

//**************************************************************
// WEAPONS
//**************************************************************

function ScoutVehicle::onTrigger(%Data, %Vehicle, %trigger, %state)
{
   if(%trigger == 0)
   {
      if (%state == 0)
      {
         // No longer firing
         %Vehicle.fireWeapon = false;
      } else {
         %Vehicle.fireWeapon = true;

         if (%Vehicle.BoosterNotReady == true)
            return;

         %EnergyLevel = %Vehicle.getEnergyLevel();
         %EnergyDrain = %Data.BoostEnergyDrain;

         %Velocity = VectorScale(%Vehicle.getVelocity(), 1.1);

         %Speed = VectorLen(%Velocity);

         if (%Speed > 60)
            %EnergyDrain *= 1.1;

         if (%Speed > 120)
            %EnergyDrain *= 1.1;

         if (%Speed > 180)
            %EnergyDrain *= 1.1;

         if (%EnergyDrain > %EnergyLevel)
         {
            messageClient(%Vehicle.lastPilot.client, 'MsgCantSitHere', 'You do not have enough energy to activate the jump booster. ~wfx/misc/misc.error.wav');
            return(0);
         }

         %Vehicle.setEnergyLevel(%EnergyLevel - %EnergyDrain);

         %Transform = %Vehicle.getTransform();
         %Position = posFromTransform(%Transform);
         %Rotation = rotFromTransform(%Transform);

         %Vector = VectorAdd(%Velocity, "0 0 10000");
         %Vehicle.applyImpulse(%Position, %Vector);

         %Vehicle.BoosterNotReady = true;
         %Vehicle.playAudio(0, SpeedBoosterSound);

         schedule(3500, 0, ResetGravCycle, %Vehicle);
      }
   }
}

function ResetGravCycle(%Vehicle)
{
   %Vehicle.BoosterNotReady = "";
}