// ------------------------------------------------------------------
// SHIELD PACK
// can be used by any armor type
// while activated, absorbs damage at cost of energy
// ------------------------------------------------------------------

// Havoc Shields are slightly more powerful, about 7%, and use a little
// less energy, about 12%.  They are also heavier, now 6 kg from 1.

datablock AudioProfile(ShieldPackActivateSound)
{
   filename = "fx/packs/shield_on.wav";
   description = ClosestLooping3d;
   preload = true;
};

datablock ShapeBaseImageData(ShieldPackImage)
{
   shapeFile = "pack_upgrade_shield.dts";
   item = ShieldPack;
   mountPoint = 1;
   offset = "0 0 0";

   mass = 6;

   ShieldStrength = 70;

   usesEnergy = true;
   minEnergy = 3;

   stateName[0] = "Idle";
   stateTransitionOnTriggerDown[0] = "Activate";
	
   stateName[1] = "Activate";
   stateScript[1] = "onActivate";
   stateSequence[1] = "fire";
   stateSound[1] = ShieldPackActivateSound;
   stateEnergyDrain[1] = 11;
   stateTransitionOnTriggerUp[1] = "Deactivate";
   stateTransitionOnNoAmmo[1] = "Deactivate";

   stateName[2] = "Deactivate";
   stateScript[2] = "onDeactivate";
   stateTransitionOnTimeout[2] = "Idle";
};

datablock ItemData(ShieldPack)
{
   className = Pack;
   catagory = "Packs";
   shapeFile = "pack_upgrade_shield.dts";
   mass = 6;
   elasticity = 0.2;
   friction = 0.6;
   pickupRadius = 2;
   rotate = true;
   image = "ShieldPackImage";
   pickUpName = "a shield pack";

   computeCRC = true;
};

function ShieldPackImage::onMount(%data, %obj, %node)
{
}

function ShieldPackImage::onUnmount(%Data, %Player, %Node)
{
   %Player.setImageTrigger(%Node, false);
   %Player.ShieldStrength = "";
}

function ShieldPackImage::onActivate(%Data, %Player, %slot)
{
   messageClient(%Player.client, 'MsgShieldPackOn', '\c2Shield pack on.');
   %Player.setImageTrigger(%slot, true);
   %Player.ShieldStrength = %Data.ShieldStrength;
}

function ShieldPackImage::onDeactivate(%Data, %Player, %slot)
{
   messageClient(%Player.client, 'MsgShieldPackOff', '\c2Shield pack off.');
   %Player.setImageTrigger(%slot, false);
   %Player.ShieldStrength = "";
}

function ShieldPack::onPickup(%this, %obj, %shape, %amount)
{
   // created to prevent console errors
}

