//=============================================================================
// SteelBarrel.
//=============================================================================
class SteelBarrel expands Decoration;

#exec MESH IMPORT MESH=steelbarrel ANIVFILE=MODELS\steelb_a.3D DATAFILE=MODELS\steelb_d.3D X=0 Y=0 Z=0 ZEROTEX=1
#exec MESH ORIGIN MESH=steelbarrel X=0 Y=0 Z=-20 YAW=0 ROLL=128
#exec MESH SEQUENCE MESH=steelbarrel SEQ=All    STARTFRAME=0  NUMFRAMES=2
#exec MESH SEQUENCE MESH=steelbarrel SEQ=Normal STARTFRAME=0  NUMFRAMES=1
#exec MESH SEQUENCE MESH=steelbarrel SEQ=Crush  STARTFRAME=1  NUMFRAMES=1
#exec TEXTURE IMPORT NAME=Jsteelbarrel1 FILE=MODELS\steelb.PCX GROUP="Skins"
#exec MESHMAP SCALE MESHMAP=steelbarrel X=0.04 Y=0.04 Z=0.08
#exec MESHMAP SETTEXTURE MESHMAP=steelbarrel NUM=0 TEXTURE=Jsteelbarrel1

var() int Health;

Auto State Animate
{

	function HitWall (vector HitNormal, actor Wall)
	{
		if (Size(Velocity)>200) PlayAnim('Crush');
		Velocity = 0.8*(( Velocity dot HitNormal ) * HitNormal * (-1.8 + FRand()*0.8) + Velocity);   // Reflect off Wall w/damping
		Velocity.Z = Velocity.Z*0.6;
		If (Size(Velocity) < 5) {
			SetPhysics(PHYS_None);	
			bBounce = False;
		}
	}

	function Bump( actor Other )
	{
		if( Pawn(Other)!=None && Pawn(Other).bIsPlayer ){
			SetPhysics(PHYS_Falling);
			bBounce = True;
			Velocity = Other.Velocity+Normal(Other.Velocity)*15;
			if (size(Velocity)>150) Velocity=150*Normal(Velocity);
			Velocity.Z += 20;
			Other.Velocity=Other.Velocity*0.5;
		}
	}


	function Damage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
						Vector momentum, name damageType)
	{
			SetPhysics(PHYS_Falling);
			bBounce = True;
			Momentum.Z = 1000;
			Velocity=Momentum*0.01;
	}


Begin:
	PlayAnim('normal');
}

