//=============================================================================
// WoodenBox.
//=============================================================================
class WoodenBox expands Decoration;

#exec MESH IMPORT MESH=WoodenBox ANIVFILE=MODELS\Box_a.3D DATAFILE=MODELS\Box_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=WoodenBox X=0 Y=0 Z=0 YAW=64
#exec MESH SEQUENCE MESH=WoodenBox SEQ=All    STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=WoodenBox SEQ=Still  STARTFRAME=0   NUMFRAMES=1
#exec TEXTURE IMPORT NAME=JWoodenBox1 FILE=MODELS\Box.PCX GROUP=Skins
#exec MESHMAP SCALE MESHMAP=WoodenBox X=0.08 Y=0.08 Z=0.16
#exec MESHMAP SETTEXTURE MESHMAP=WoodenBox NUM=1 TEXTURE=JWoodenBox1

var() int Health;
var() int FragChunks;
var() Float Fragsize;

function PreBeginPlay()
{
	// some boxes will float (randomly)
	if ( Buoyancy == Default.Buoyancy)
		Buoyancy = Mass * (0.9 + 0.6 * FRand());

	CallParent.PreBeginPlay();
}

Auto State Animate
{

	function Damage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
						Vector momentum, name damageType)
	{
		Instigator = InstigatedBy;
		if (Health<0) Return;
		bBobbing = false;
		Health -= NDamage;
		if (Health <0) 	
			Frag(Class'WoodFragments',Momentum,FragSize,FragChunks);		
		else 
		{
			SetPhysics(PHYS_Falling);
			Momentum.Z = 1000;
			Velocity=Momentum*0.016;
		}
	}
}

