//=============================================================================
// TentacleProjectile.
//=============================================================================
class TentacleProjectile expands Projectile;

#exec MESH IMPORT MESH=TentProjectile ANIVFILE=MODELS\Tproj_a.3D DATAFILE=MODELS\Tproj_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=TentProjectile X=0 Y=0 Z=0 YAW=64
#exec MESH SEQUENCE MESH=TentProjectile SEQ=All  STARTFRAME=0  NUMFRAMES=1
#exec TEXTURE IMPORT NAME=JTentacle1 FILE=MODELS\Tentacle.PCX GROUP="Skins" 
#exec MESHMAP SCALE MESHMAP=TentProjectile X=0.02 Y=0.02 Z=0.04
#exec MESHMAP SETTEXTURE MESHMAP=TentProjectile NUM=4 TEXTURE=JTentacle1

#exec AUDIO IMPORT FILE="Sounds\tentacle\tensht1.WAV" NAME="TentSpawn" GROUP="Tentacle"
#exec AUDIO IMPORT FILE="Sounds\tentacle\tenimp2.WAV" NAME="TentImpact" GROUP="Tentacle"

auto state Flying
{
	function ProcessTouch (Actor Other, Vector HitLocation)
	{
		local vector momentum;
	
		if ((Tentacle(Other) == None) && (TentacleProjectile(Other) == None))
		{
			momentum = 10000.0 * Normal(Velocity);
			Other.Damage(Damage, instigator, HitLocation, momentum, 'stung');
			Destroy();
		}
	}
	
	function Explode(vector HitLocation, vector HitNormal)
	{
		PlaySound(ImpactSound);
		spawn(class'SmallSpark2',,,HitLocation+HitNormal*5,rotation(HitNormal*2+VRand()));
		destroy();
	}

	function BeginState()
	{
		Velocity = Vector(Rotation) * speed;
		PlaySound(SpawnSound);
	}

Begin:
	Sleep(7.0); //self destruct after 7.0 seconds
	Explode(Location, vect(0,0,0));
	
}

