//=============================================================================
// Invisibility.
//=============================================================================
class Invisibility expands PickUp;

#exec TEXTURE IMPORT NAME=I_Invisibility FILE=TEXTURES\HUD\i_Invis.PCX GROUP="Icons"

#exec AUDIO IMPORT FILE="Sounds\Pickups\Scloak1.WAV" NAME="Invisibility" GROUP="Pickups"

#exec MESH IMPORT MESH=InvisibilityMesh ANIVFILE=MODELS\Invis_a.3D DATAFILE=MODELS\Invis_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=InvisibilityMesh X=0 Y=0 Z=-15
#exec MESH SEQUENCE MESH=InvisibilityMesh SEQ=All    STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=InvisibilityMesh SEQ=Still  STARTFRAME=0   NUMFRAMES=1
#exec TEXTURE IMPORT NAME=JInvisibility1 FILE=MODELS\Invis.PCX GROUP=Skins 
#exec OBJ LOAD FILE=Textures\fireeffect26.utx  PACKAGE=UNREALI
#exec MESHMAP SCALE MESHMAP=InvisibilityMesh X=0.05 Y=0.05 Z=0.1
#exec MESHMAP SETTEXTURE MESHMAP=InvisibilityMesh NUM=1 TEXTURE=JInvisibility1
#exec MESHMAP SETTEXTURE MESHMAP=InvisibilityMesh NUM=0 TEXTURE=FireEffect26

var byte TempVis;


function Invisibility (bool Vis)
{ 
	if( Vis )
	{
		PlaySound(ActivateSound);		
		PlayerPawn(Owner).ClientAdjustGlow(vect(-0.15,-0.15,-0.15), vect(0.15625,0.15625,0.351625));
		Pawn(Owner).Visibility = 10;
		Pawn(Owner).bHidden=True;
		Pawn(Owner).Weapon.bOnlyOwnerSee=False;			
	}
	else
	{
		PlaySound(DeActivateSound);
		PlayerPawn(Owner).ClientAdjustGlow(vect(0.15,0.15,0.15), vect(-0.15625,-0.15625,-0.351625));	
		Pawn(Owner).Visibility = 128;
		Pawn(Owner).bHidden=False;
		Pawn(Owner).Weapon.bOnlyOwnerSee=True;
	}
}

state Activated
{
	function endstate()
	{
		Invisibility(False);
		bActive = false;		
	}
	function Timer()
	{
		Charge -= 1;
		if (Pawn(Owner).bHidden == False) Pawn(Owner).bHidden=True;		
		if (Charge<-0) {	
			Pawn(Owner).ClientMessage(ExpireMessage);	
			UsedUp();
		}
	}
Begin:
	Invisibility(True);
	SetTimer(0.2,True);
}

state DeActivated
{
Begin:
}

