
datablock AudioProfile(IBLSwitchSound)
{
   filename    = "fx/powered/turret_light_activate.wav";
   description = AudioClose3d;
   preload = true;
};

datablock AudioProfile(IBLFireSound)
{
   filename    = "fx/powered/turret_indoor_fire.wav";
   description = AudioDefault3d;
   preload = true;
};

datablock SensorData(DeployedIndoorTurretSensor)
{
   detects = true;
   detectsUsingLOS = true;
   detectsPassiveJammed = false;
   detectsActiveJammed = false;
   detectsCloaked = false;
   detectionPings = true;
   detectRadius = 40;
};

datablock ShapeBaseImageData(TurretIndoorDeployableImage)
{
   shapeFile = "pack_deploy_turreti.dts";

   item = TurretIndoorDeployable;
   mountPoint = 1;
   offset = "0 0 0";

   mass = 9.5;

   isLarge = false;

   deploySound = TurretDeploySound;

   stateName[0] = "Idle";
   stateTransitionOnTriggerDown[0] = "Activate";

   stateName[1] = "Activate";
   stateScript[1] = "onActivate";
   stateTransitionOnTriggerUp[1] = "Idle";

   maxDepSlope = 360;

   emap = true;
};

datablock ItemData(TurretIndoorDeployable)
{
   className = Pack;
   catagory = "Deployables";

   shapeFile = "pack_deploy_turreti.dts";

   image = TurretIndoorDeployableImage;

   mass = 9.5;
   elasticity = 0.2;
   friction = 0.6;

   rotate = false;

   pickupRadius = 1;
   pickUpName = "a spider clamp turret pack";

   computeCRC = true;
   emap = true;

   isTurret = true;
};

datablock TurretData(TurretDeployedFloorIndoor) : TurretDamageProfile
{
   className = DeployedTurret;
   shapeFile = "turret_indoor_deployf.dts";

   mass = 9.5;
   maxDamage = 0.5;
   destroyedLevel = 0.5;
   disabledLevel = 0.3;
   repairRate = 0;
   heatSignature = 0.0;
   explosion = SmallTurretExplosion;

   deployedObject = true;

   thetaMin = 5;
   thetaMax = 145;
   thetaNull = 90;

   primaryAxis = zaxis;

   engType = "SmallTurret";
   item = TurretIndoorDeployable;

   isShielded = true;
   energyPerDamagePoint = 100;
   maxEnergy = 40;
   rechargeRate = 0.10;

   DefaultBarrel = IonTurretBarrel;
   SmallTurretBase = true;
   Name = "Spider Clamp Turret";

   canControl = false;
   cmdCategory = "DTactical";
   cmdIcon = CMDTurretIcon;
   cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
   targetNameTag = 'Spider Clamp';
   targetTypeTag = 'Turret';
   sensorData = DeployedIndoorTurretSensor;
   sensorRadius = DeployedIndoorTurretSensor.detectRadius;
   sensorColor = "191 0 226";

   firstPersonOnly = true;
   renderWhenDestroyed = false;

   debrisShapeName = "debris_generic_small.dts";
   debris = TurretDebrisSmall;
};

datablock TurretData(TurretDeployedWallIndoor) : TurretDamageProfile
{
   className = DeployedTurret;
   shapeFile = "turret_indoor_deployw.dts";

   mass = 6.5;
   maxDamage = 0.5;
   destroyedLevel = 0.5;
   disabledLevel = 0.3;
   repairRate = 0;
   heatSignature = 0.0;
   explosion = SmallTurretExplosion;

   thetaMin = 5;
   thetaMax = 145;
   thetaNull = 90;

   deployedObject = true;
   
   primaryAxis = yaxis;

   item = TurretIndoorDeployable;

   isShielded = true;
   energyPerDamagePoint = 100;
   maxEnergy = 30;
   rechargeRate = 0.10;

   DefaultBarrel = IonTurretBarrel;

   SmallTurretBase = true;
   Name = "Spider Clamp Turret";

   engType = "SmallTurret";
   canControl = false;
   cmdCategory = "DTactical";
   cmdIcon = CMDTurretIcon;
   cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
   targetNameTag = 'Spider Clamp';
   targetTypeTag = 'Turret';
   sensorData = DeployedIndoorTurretSensor;
   sensorRadius = DeployedIndoorTurretSensor.detectRadius;
   sensorColor = "191 0 226";

   firstPersonOnly = true;
   renderWhenDestroyed = false;

   debrisShapeName = "debris_generic_small.dts";
   debris = TurretDebrisSmall;
};

datablock TurretData(TurretDeployedCeilingIndoor) : TurretDamageProfile
{
   className = DeployedTurret;
   shapeFile = "turret_indoor_deployc.dts";

   mass = 6.5;
   maxDamage = 0.5;
   destroyedLevel = 0.5;
   disabledLevel = 0.3;
   repairRate = 0;
   explosion = SmallTurretExplosion;

   //thetaMin = 5;
   //thetaMax = 145;
   thetaMin = 35;
   thetaMax = 175;
   thetaNull = 90;
   heatSignature = 0.0;

   deployedObject = true;
    
   primaryAxis = revzaxis;

   isShielded = true;
   energyPerDamagePoint = 100;
   maxEnergy = 30;
   rechargeRate = 0.10;

   DefaultBarrel = IonTurretBarrel;
   SmallTurretBase = true;

   Name = "Spider Clamp Turret";
   engType = "SmallTurret";

   item = TurretIndoorDeployable;

   canControl = false;
   cmdCategory = "DTactical";
   cmdIcon = CMDTurretIcon;
   cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
   targetNameTag = 'Spider Clamp';
   targetTypeTag = 'Turret';
   sensorData = DeployedIndoorTurretSensor;
   sensorRadius = DeployedIndoorTurretSensor.detectRadius;
   sensorColor = "191 0 226";

   firstPersonOnly = true;
   renderWhenDestroyed = false;

   debrisShapeName = "debris_generic_small.dts";
   debris = TurretDebrisSmall;
};

function TurretDeployedFloorIndoor::ItemSwap(%Data, %Object)
{
   %Transform = %Object.getTransform();
   %Position = posFromTransform(%Transform);

   %Item = %Object.getDataBlock().item;

   %NewItem = new Item()
   {
      dataBlock = %Item;
      position = %Position;
   };
   MissionCleanup.add(%NewItem);

   %Item.Barrel = %Object.getMountedImage(0);

   $TeamDeployedCount[%Object.team, %Item]--;

   %NewItem.applyImpulse(%Position, "0 0 5");

   %Object.delete();
   %NewItem.schedulePop();
}

function TurretDeployedWallIndoor::ItemSwap(%Data, %Object)
{
   %Position = %Object.getMuzzlePoint(0);

   %Item = %Object.getDataBlock().item;

   %NewItem = new Item()
   {
      dataBlock = %Item;
      position = %Position;
   };
   MissionCleanup.add(%NewItem);

   %Item.Barrel = %Object.getMountedImage(0);

   $TeamDeployedCount[%Object.team, %Item]--;

   %Vector = %Object.getMuzzleVector(0);
   %Vector = VectorScale(%Vector, 10);
   %NewItem.applyImpulse(%Position, %Vector);

   %Object.delete();
   %NewItem.schedulePop();
}

function TurretDeployedCeilingIndoor::ItemSwap(%Data, %Object)
{
   %Position = %Object.getMuzzlePoint(0);

   %Item = %Object.getDataBlock().item;

   %NewItem = new Item()
   {
      dataBlock = %Item;
      position = %Position;
   };
   MissionCleanup.add(%NewItem);

   %Item.Barrel = %Object.getMountedImage(0);

   $TeamDeployedCount[%Object.team, %Item]--;

   %NewItem.applyImpulse(%Position, "0 0 -10");

   %Object.delete();
   %NewItem.schedulePop();
}
