
class MonsterEnergyDrink extends TournamentPickUp;

#exec audio import file="Sounds\gulp.wav" name="gulp" group="Sounds"
#exec AUDIO IMPORT FILE="Sounds\SpeedWind.WAV" NAME="SpeedWind"

#exec MESH IMPORT MESH=RBull ANIVFILE=MODELS\WSCoke_a.3D DATAFILE=MODELS\WSCoke_d.3D X=0 Y=0 Z=0
#exec MESH LODPARAMS MESH=RBull STRENGTH=0.1
#exec MESH ORIGIN MESH=RBull X=0 Y=0 Z=0 YAW=0 PITCH=0 ROLL=0
#exec MESH SEQUENCE MESH=RBull SEQ=All    	STARTFRAME=0  NUMFRAMES=2
#exec MESH SEQUENCE MESH=RBull SEQ=normal    STARTFRAME=0  NUMFRAMES=1
#exec MESH SEQUENCE MESH=RBull SEQ=dented    STARTFRAME=1  NUMFRAMES=1

#exec MESHMAP SCALE MESHMAP=RBull X=0.0125 Y=0.0125 Z=0.025

#exec TEXTURE IMPORT NAME=MonsterDrinkTex FILE=Textures\MonsterDrinkTex.BMP GROUP=Skins FLAGS=2
#exec MESHMAP SETTEXTURE MESHMAP=RBull NUM=0 TEXTURE=MonsterDrinkTex

var MDCrushed RB;

function ThrowCan()
{
	local Vector Start, X,Y,Z,dir;

	dir = vector(Pawn(Owner).ViewRotation);
   RB = Spawn(class'MDCrushed',,,Pawn(Owner).Location + vect(0,0,50));
   if (RB!=None)
		RB.Velocity = 300 * Normal(dir);
}

state Activated
{
   function endstate()
   {
    	local float SpeedScale;

      bActive = false;
      SetTimer(0.0, False);

      if (Level.Game.IsA('DeathMatchPlus') && DeathMatchPlus(Level.Game).bMegaSpeed)
         SpeedScale = 1.3;
      else
         SpeedScale = 1.0;
      Pawn(Owner).AirControl = DeathMatchPlus(Level.Game).AirControl;
      Pawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * Level.Game.PlayerJumpZScaling();
      Pawn(Owner).GroundSpeed = Pawn(Owner).Default.GroundSpeed * SpeedScale;
      Pawn(Owner).WaterSpeed = Pawn(Owner).Default.WaterSpeed * SpeedScale;
      Pawn(Owner).AirSpeed = Pawn(Owner).Default.AirSpeed * SpeedScale;
      Pawn(Owner).Acceleration = Pawn(Owner).Default.Acceleration * SpeedScale;
      Pawn(Owner).AmbientSound = None;
   }

   function Timer()
   {
      Charge -= 1;
      if (Charge == 96)
			ThrowCan();

      if (Charge<-0)
         UsedUp();
   }

   function BeginState()
   {
      bActive = true;
      PlaySound(ActivateSound,,4.0);
      SetTimer(0.5,True);
      Pawn(Owner).AirControl = 0.65;  // Speed up the player
      Pawn(Owner).JumpZ *= 1.4;
      Pawn(Owner).GroundSpeed *= 1.3;
      Pawn(Owner).WaterSpeed *= 1.3;
      Pawn(Owner).AirSpeed *= 1.3;
      Pawn(Owner).Acceleration *= 1.3;
      Pawn(Owner).AmbientSound = sound'SpeedWind';   //wind effect
      Pawn(Owner).SoundRadius = 64;
   }
}

state DeActivated
{
Begin:
}

defaultproperties
{
	bCanHaveMultipleCopies=false
   ExpireMessage="Energy drink has worn off."
   bAutoActivate=True
   bActivatable=True
   PickupMessage="You picked up an energy drink"
   ItemName="MonsterDrink"
   Charge=100
   MaxDesireability=1.200000
   ActivateSound=none
   bRotatingPickup=False
   DrawType=DT_Mesh
   Mesh=LodMesh'RBull'
   RespawnTime=30.00
   PickupViewMesh=LodMesh'RBull'
   PickupSound=Sound'gulp'
   CollisionRadius=6.0
   CollisionHeight=10.0
   RemoteRole=ROLE_DumbProxy
   Physics=PHYS_Falling
}
