//=============================================================================
// CrucifiedNali.
//=============================================================================
class CrucifiedNali expands NaliCarcass;

#exec MESH IMPORT MESH=CrossNali ANIVFILE=MODELS\nali_x.3D DATAFILE=MODELS\nali_d.3D X=0 Y=0 Z=0 ZEROTEX=1
#exec MESH ORIGIN MESH=CrossNali X=00 Y=-130 Z=30 YAW=64 ROLL=-64

#exec MESH SEQUENCE MESH=CrossNali SEQ=All      		STARTFRAME=0   NUMFRAMES=100
#exec MESH SEQUENCE MESH=CrossNali SEQ=HeadDown 		STARTFRAME=0   NUMFRAMES=40
#exec MESH SEQUENCE MESH=CrossNali SEQ=Writhe      	STARTFRAME=40  NUMFRAMES=60

#exec TEXTURE IMPORT NAME=JNali1 FILE=MODELS\nali.PCX GROUP=Skins 
#exec MESHMAP SCALE MESHMAP=crossnali X=0.072 Y=0.072 Z=0.144
#exec MESHMAP SETTEXTURE MESHMAP=crossnali NUM=0 TEXTURE=Jnali1

auto state Dying
{
	function AnimEnd()
	{
		if ( (AnimSequence == 'HeadDown') && (FRand() < 0.1) )
			PlayAnim('Writhe', 0.3 + 0.6 * FRand());
		else
			PlayAnim('HeadDown', 0.3 + 0.6 * FRand());
	}
	
	function Damage( int Damage, Pawn instigatedBy, Vector hitlocation, 
							Vector momentum, name damageType)
	{
		if ( (Damage > FMax(30, Mass/6)) || (momentum.Z/mass > 150) )
		{
			Velocity = momentum/Mass;
			ChunkUp(Damage);
		}
		else
		{
			CumulativeDamage += Damage;
			PlayAnim('Writhe', 0.7, 0.1);
			if ( CumulativeDamage > 120 )
				Disable('AnimEnd');
		}
	}
	
Begin:
	PlayAnim('HeadDown');
}

