
class AirdropWithChute extends Projectile;

#exec obj load file=..\Textures\Starship.utx package=Starship

#exec mesh import mesh=AirdropWithChute anivfile=Models\AirdropWithChute_a.3d datafile=Models\AirdropWithChute_d.3d x=0 y=0 z=0 mlod=0
#exec mesh origin mesh=AirdropWithChute x=0 y=0 z=0 PITCH=128 ROLL=0 YAW=0
#exec mesh sequence mesh=AirdropWithChute seq=All startframe=0 numframes=1

#exec meshmap new meshmap=AirdropWithChute mesh=AirdropWithChute
#exec meshmap scale meshmap=AirdropWithChute x=0.34375 y=0.34375 z=0.68750

#exec TEXTURE IMPORT NAME=CrateBottom 	FILE=Textures\CrateBottom.BMP GROUP=Skins
#exec TEXTURE IMPORT NAME=ChuteCamo 	FILE=Textures\ChuteCamo.BMP GROUP=Skins

#exec AUDIO IMPORT NAME=metalthump FILE=Sounds\metalthump.wav


simulated function PostBeginPlay()
{
   Super.PostBeginPlay();

   Acceleration = vect(0,0,-1);
   Velocity = Vector(Rot(-16360,0,0)) * 80.0;
}

simulated function HitWall (vector HitNormal, actor Wall)
{
	SetCollision(false, false, false);
	PlaySound(sound'metalthump');
	Spawn(class'AirdropCrate',self,,Location + Vect(0,0,-80));
	//Effects when hitting ground
	Spawn(class'SpriteSmokePuff',self,,Location + Vect(30,0,-80));
	Spawn(class'SpriteSmokePuff',self,,Location + Vect(30,30,-80));
	Spawn(class'SpriteSmokePuff',self,,Location + Vect(-30,0,-80));
	Spawn(class'SpriteSmokePuff',self,,Location + Vect(-30,-30,-80));
   Destroy();
}

function TakeDamage(int NDamage, Pawn instigatedBy,Vector hitlocation, Vector momentum, name damageType)
{
   local int i;
   local Fragment s;

   if (Region.Zone.bDestructive)
   {
      Destroy();
      return;
   }
   for (i=0 ; i<12 ; i++)
   {
   	s = Spawn(Class'WoodFragmentsBRUT', self);
		s.Velocity = VRand()*(256+FRand()*150.0+225);
      s.DrawScale = 1.75*0.5+0.7*1.75*FRand();
   }
   Destroy();
}
 
auto state Flying
{
   function BeginState()
   {
      Velocity = Vector(Rot(-16360,0,0)) * 80.0;
   }
}

defaultproperties
{
	Speed=80
	MaxSpeed=80
	AmbientGlow=102
	SoundRadius=32
	SoundVolume=204
  	DrawType=DT_Mesh
  	Mesh=Mesh'AirdropWithChute'
  	CollisionRadius=64.00000
  	CollisionHeight=88.00000
  	MultiSkins(0)=Texture'Starship.Mask.sh_grd3m'
  	MultiSkins(1)=Texture'Starship.Floor.sh_grf'
  	MultiSkins(2)=Texture'CrateSide'
  	MultiSkins(3)=Texture'CrateTop'
  	MultiSkins(4)=Texture'ChuteCamo'
  	MultiSkins(5)=Texture'CrateBottom'
   LightType=LT_SubtlePulse
   LightBrightness=154
   LightHue=24
   LightSaturation=0
   LightRadius=10
   bFixedRotationDir=True
   RotationRate=(Yaw=7000)
   DesiredRotation=(Yaw=7000)
   bNetTemporary=False
}

